I have an ASP.NET MVC application that I want to deploy to both IIS6 and IIS7, and as we all know, IIS6 needs a ".mvc" name in the url.
Will this code work to make sure it works on all versions of IIS? Without the need to make special changes to the code, global.asax or config files for different versions of IIS.
bool usingIntegratedPipeline = HttpRuntime.UsingIntegratedPipeline;
routes.MapRoute(
"Default",
usingIntegratedPipeline ?
"{controller}/{action}/{id}" : "{controller}.mvc/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
Update : forgot to mention. No ISAPI. Website hosting, without control over the IIS server.
source
share