现在的位置: 首页 > 综合 > 正文

asp.net 4.0 在webconfig 设置 url映射

2013年09月05日 ⁄ 综合 ⁄ 共 1526字 ⁄ 字号 评论关闭

 

设置映射的路径 

    <urlMappings enabled="true">

      <add url="~/test.html" mappedUrl="~/Handler.ashx" />

    </urlMappings>

配置

<system.webServer>
        <handlers>
            <add name="html-Integrate" path="*.html" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" preCondition="integratedMode" />
            <add name="htmlRequest" path="*.html" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
        </handlers>
    </system.webServer>

全部的webconfig

<configuration>
  <appSettings>
    <add key="ConStringEncrypt" value="false" />
    <add key="ConnectionString" value="server=127.0.0.1;database=codematic;uid=sa;pwd=1" />
  </appSettings>
  <system.web>    
    <compilation debug="true" targetFramework="4.0" />
    <urlMappings enabled="true">

      <add url="~/test.html" mappedUrl="~/Handler.ashx" />

    </urlMappings>
    
    <customErrors mode="On" defaultRedirect="res://ieframe.dll/http_404.html"></customErrors>
  </system.web>
    <system.webServer>
        <handlers>
            <add name="html-Integrate" path="*.html" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" resourceType="Unspecified" preCondition="integratedMode" />
            <add name="htmlRequest" path="*.html" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
        </handlers>
    </system.webServer>
</configuration>

这样就ok了。

抱歉!评论已关闭.