开发者

Running ASP.NET MVC 2 project not in root of the domain, but in folder

Good day!

I need to run ASP.NET MVC application not in the root of the server (like http://example.com), but in the folder (I thin开发者_Go百科k in will be configured as virtual folder in IIS), say: http://example.com/mymvcapp

For now all routing helpers generate urls from the root with trailing slash, like /controller/action/id.

Thanks in advance!


Url helpers always generate correct routes and take into consideration the virtual directory your application runs in. So if you have a virtual directory called mymvcapp in IIS under the site root and you deploy your application inside the physical folder this directory is pointing to when you write:

<%: Url.Action("index", "home") %>

This will generate*:

/mymvcapp/home/index

* assuming default routes obviously

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜