Is it possible to run an MVC application from a virtual directory in IIS7? I have built an open source utility app in ASP.NET MVC3 and wondering if that was a mistake; it likely is if the site cannot be run from a virtual directory.
Take a simple default route of /home/index if running from a virtual directory named /app, will actually be /app/home index. Which kind of messes things up for routing.
I don’t want a user to have to change routes and recompile the project to use the app in a virtual directory. Is there a way to change a configuration parameter to indicate what the root folder of what the application is?
Not only that it is possible but it is the preferred way.
Not if you use Html helpers when dealing with urls which will take care of this.
Here’s a typical example of what you should never do:
and here’s how this should be done:
Here’s another typical example of something that you should never do:
and here’s how this should be written:
Here’s another example of something that you should never do:
and here’s how this should be written:
I think you get the point.