In the MVC mode, the URLs that are friendly and block specific physical files are visible to me. I also want to use them in the web form project.
Follow the instructions to add global. asax and write the routeCodeOr something:
<% @ Application language = "C #" %> <% @ import namespace = "system. web. routing "%> <SCRIPT runat =" server "> void application_start (Object sender, eventargs e) {// In the applicationProgramCode that runs at startup: registerroutes (routetable. routes);} public static void registerroutes (routecollection routes) {routes. mappageroute ("","","~ /Default. aspx "); routes. mappageroute (" test "," H/{product }","~ /Temp/test. aspx ");}
When you run the command in IIS, page not found is returned!
Then run the command in vs2012, but the route is incorrectly written.
According to Daniel, in versions earlier than iis7, you must specify the suffix name and Add. aspx. For example, this method should be used.
Routes. mappageroute ("test", "H. aspx/{product }","~ /Temp/test. aspx ");
What is the significance of this route? But I tried it. But this is boring.
This indicates that in iis7.5, if. aspx is not specified, it is not processed by ASP. NET at all, and routing does not work.
This is strange, my IIS is iis7.5 under win7, the application pool mode is integration, Asp. net4.0, everything is in line with the legendary "you can directly use ASP without any configuration.. net routing.
Is it because I installed Microsoft's URL rewriting module? Uninstall and restart. No.
You cannot register ASP. net4.0 again.
Who will tell me?