设置映射的路径
<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了。