在web.config中做如下配置:
1.在紧接着<configuration>之后配置如下代码:
<configSections>
<section name="urlrewritingnet" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter"/>
</configSections>
注:如果<configSections></configSections>存在则直接在其中配置<section name="urlrewritingnet" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter"/>
即可。
2.在紧接着</configSections>之后配置如下代码:
<urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="index.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
<add name="Rewrite1" virtualUrl="^~/test/0000(/d+).html" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/test/test.aspx?id=$1" ignoreCase="true"/>
<!--更多重写规则-->
</rewrites>
</urlrewritingnet>
3.在<system.web></system.web>之间配置如下代码:
<httpModules>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
</httpModules>
注:如果<httpModules></httpModules>存在则直接在其中配置<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>即可。
最后,引用UrlRewritingNet.UrlRewriter.dll文件。