Using MVC sometimes we hope that the browse address ends with a suffix named. html. htm.
So we modify the routing configuration information in the Routeconfig, and the modified code is as follows
Routes. Ignoreroute ("{Resource}.axd/{*pathinfo}"); Routes. MapRoute (Name:"Default", URL:"{controller}/{action}.html", defaults:New{controller =" Public", action ="Login", id =urlparameter.optional});
But when the visit, tip 404, how to do that? Where is the problem, check out the simplest way to:
On the web. New configuration in config
New Under System.webserver
<modules runallmanagedmodulesforallrequests= "true" ></modules> OK
The explanations are as follows:
What the hell is runallmanagedmodulesforallrequests?
It means a switch for all Modules management requests, if set to true, that is, all requests to the Modules channel through, there is no block, then what is Modules? The literal meaning can be understood as "module" or "unit" meaning, it is something belonging to the Web server, and the Web application is not very relevant, the Web application just to launch a request for it, Modules related things, you can look at this very good article: IIS Modules Overview.
Summary: There should be other solutions to the problem of 404 routing resolution, and this approach is also flawed.
Reference URL: http://www.mamicode.com/info-detail-448415.html
The AspNet MVC Route parsing adds the. html suffix 404 Error Resolution