富贵资源网 Design By www.hznty.com
复制代码 代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--第一步注册url重写模块放到webconfig的最上部-->
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<!--第二步添加重写规则-->
<RewriterConfig>
<!--先制定全部重写规则内容-->
<Rules>
<!--制定每个单独页面的规则-->
<RewriterRule>
<!--原始请求地址-->
<SendTo><![CDATA[~/news.aspx?id=$1&pid=$2]]></SendTo>
<!--重写后的地址-->
<LookFor>~/news/(.[0-9]*)/(.[\d]*)\.html</LookFor>
</RewriterRule>
<RewriterRule>
<!--原始请求地址-->
<SendTo><![CDATA[~/product.aspx?pid=$1]]></SendTo>
<!--重写后的地址-->
<LookFor>~/product/(.[\d]*)\.zangdalei</LookFor>
</RewriterRule>
</Rules>
</RewriterConfig>
<system.web>
<compilation debug="false" targetFramework="4.0">
<!--第四部url重写防止真实的页面也被重写如果网站中真实存在页面,需要添加编译指令不编译真实的html文件-->
<buildProviders>
<add extension=".html" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>
<!--第三部url重写 将用户的请求页面交给相应的处理程序,注意请求的后缀名格式-->
<httpHandlers>
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.zangdalei" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="aspnethtml" path="*.html" verb="GET,POST" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
<add name="aspnetzangdalei" path="*.zangdalei" verb="GET,POST" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
</handlers>
<defaultDocument>
<files>
<clear />
<add value="default.aspx" />
<add value="default.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--第一步注册url重写模块放到webconfig的最上部-->
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<!--第二步添加重写规则-->
<RewriterConfig>
<!--先制定全部重写规则内容-->
<Rules>
<!--制定每个单独页面的规则-->
<RewriterRule>
<!--原始请求地址-->
<SendTo><![CDATA[~/news.aspx?id=$1&pid=$2]]></SendTo>
<!--重写后的地址-->
<LookFor>~/news/(.[0-9]*)/(.[\d]*)\.html</LookFor>
</RewriterRule>
<RewriterRule>
<!--原始请求地址-->
<SendTo><![CDATA[~/product.aspx?pid=$1]]></SendTo>
<!--重写后的地址-->
<LookFor>~/product/(.[\d]*)\.zangdalei</LookFor>
</RewriterRule>
</Rules>
</RewriterConfig>
<system.web>
<compilation debug="false" targetFramework="4.0">
<!--第四部url重写防止真实的页面也被重写如果网站中真实存在页面,需要添加编译指令不编译真实的html文件-->
<buildProviders>
<add extension=".html" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>
<!--第三部url重写 将用户的请求页面交给相应的处理程序,注意请求的后缀名格式-->
<httpHandlers>
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.zangdalei" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
</system.web>
<system.webServer>
<handlers>
<add name="aspnethtml" path="*.html" verb="GET,POST" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
<add name="aspnetzangdalei" path="*.zangdalei" verb="GET,POST" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
</handlers>
<defaultDocument>
<files>
<clear />
<add value="default.aspx" />
<add value="default.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...