I recently had to look into how to get requests to /TestApp within an ASP.NET MVC site resolving to another application, instead of picking up the default routing rule and trying to find the Index action on a TestApp controller class. A scenario where this may occur would be setting up a wiki application to run on /wiki off your main domain name.
First off, we need to ensure that the routing module doesn’t kick in and attempt to handle the request. This can be achieved by making the following change in global.asax of the MVC app…
routes.IgnoreRoute("{*path}", new { path = @"TestApp\/(.*)" });
You can then create a new virtual directory in IIS under the main site, and convert it into an application to ensure it’s running in a seperate AppPool etc.
The final step is to ensure that web application settings in the parent application don’t cascade and get applied to the child application. This is achieved by wrapping all of the main configuration in a location block, and setting inheritInChildApplications to false like so…
<location path="." inheritInChildApplications="false"> <system.web>Blah</system.web> <system.webServer>Blah</system.webServer> </location>
The most useful reading on this I could find was this forum post.
