asp.net 4.0 在webconfig 設置 url映射

 

設置映射的路徑 

    <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了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章