ASP.NET MVC: Creating IIS6 and IIS7-friendly Routes / URLs

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.

+3
source share
2 answers

.mvc, IIS7. - IIS7, "2.0 Integrated Pipeline", false. .mvc asp.net isapi dll, , .

, , , MVC IIS6, : http://msmvps.com/blogs/omar/archive/2008/06/30/deploy-asp-net-mvc-on-iis-6-solve-404-compression-and-performance-problems.aspx

+3

ISAPI URL-, URL-, IIS 6.

Look, for example, here

0
source

Source: https://habr.com/ru/post/1697264/


All Articles