mvc url 伪静态

来源:转载

WebConfig配置

 1 <system.webServer> 2 <validation validateIntegratedModeConfiguration="false" /> 3 <handlers> 4 <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /> 5 <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /> 6 <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> 7 <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%/Microsoft.NET/Framework/v4.0.30319/aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> 8 <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%/Microsoft.NET/Framework64/v4.0.30319/aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> 9 <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />10 11 <!--伪静态 开始-->12 <add name="(HTML) ExtensionlessUrlHandler-ISAPI-4.0_32bit"13 path="*.html"14 verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"15 modules="IsapiModule"16 scriptProcessor="%windir%/Microsoft.NET/Framework/v4.0.30319/aspnet_isapi.dll"17 preCondition="classicMode,runtimeVersionv4.0,bitness32"18 responseBufferLimit="0" />19 <add name="(HTML) ExtensionlessUrlHandler-ISAPI-4.0_64bit"20 path="*.html"21 verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"22 modules="IsapiModule"23 scriptProcessor="%windir%/Microsoft.NET/Framework64/v4.0.30319/aspnet_isapi.dll"24 preCondition="classicMode,runtimeVersionv4.0,bitness64"25 responseBufferLimit="0" />26 <add name="(HTML) ExtensionlessUrlHandler-Integrated-4.0"27 path="*.html"28 verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"29 type="System.Web.Handlers.TransferRequestHandler"30 preCondition="integratedMode,runtimeVersionv4.0" />31 <!--伪静态 结束-->32 </handlers>33 </system.webServer>

路由设置

 1 public class RouteConfig 2 { 3 public static void RegisterRoutes(RouteCollection routes) 4 { 5 routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 6 7 routes.MapRoute( 8 name: "Default", 9 url: "{controller}/{action}/{id}.html",10 defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }11 );12 }13 }

参考自: http://m.blog.csdn.net/blog/shandian84/40903663


分享给朋友:
您可能感兴趣的文章:
随机阅读: