解决 伪静态中真正html无法访问的问题

.html => C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll   脚本引擎打勾,确认文件是否存在去掉


伪静态规则

 void Application_Start(object sender, EventArgs e)
    {
        //在应用程序启动时运行的代码
        RegisterRoutes(RouteTable.Routes);
    }


 void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute("default2",
           "mingpian-{parm}/",
           "~/mpList.aspx", false,
           new RouteValueDictionary { { "parm", "1" } });

        routes.MapPageRoute("mpOnline",
          "mingpian/mingpian-{id}.html",
          "~/mpOnline.aspx", false,
          new RouteValueDictionary { });
    }


如果出现真正html无法访问的话,在web.config中加入


<compilation debug="false">
      <buildProviders>
        <add extension=".html" type="System.Web.Compilation.PageBuildProvider" />
      </buildProviders>
    </compilation>

<httpHandlers>
<add verb="*" path="*.html" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>

静态和伪静态都能正常访问


你可能感兴趣的:(html,windows,object,application,extension,compilation)