Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://www.asp.net/mvc/tutorials/older-versions/deployment/using-asp-net-mvc-with-different-versions-of-iis-cs" rel="nofollow">Using ASP.NET MVC with Different Versions of IIS (C#)</a> had it step by step for shared host IIS 6 to use MVC routing. It was even on the VS generated page, but I had ignored it.</p> <p>So for anyone else having the similar headache, here is important parts.<br> 1. Assuming it is a <strong>shared host</strong> that we can't do much server config.<br> 2. <strong>IIS 6, .Net 4.0</strong>, and possibly Windows 2003</p> <p>In our Asp.Net MVC 4, <code>global.asax.cs</code> register routs</p> <pre><code>public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", "{controller}.aspx/{action}/{id}", new { action = "Index", id = "" } ); routes.MapRoute( "Root", "", new { controller = "Home", action = "Index", id = "root" } ); } protected void Application_Start() { RegisterRoutes(RouteTable.Routes); //RouteConfig.RegisterRoutes didn't work } </code></pre> <p>Since <code>.aspx</code> files are directed to ASP.Net for processing, these routing rules will catch <code>http://domain/home.apspx/index</code> to invoke <code>HomeController.Index</code>.<br> If there is a need to ignore some files, just prepend a ignoring rule like below</p> <pre><code>routes.IgnoreRoute("Content/{*pathInfo}"); routes.IgnoreRoute("info.aspx"); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload