首先下载UrlRewriter
将它引用到你的网站中,然后在web.config中的configuration下增加configSections节点和rewriter节点
<configSections>
<section name="rewriter" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<rewriter>
<rewrite url="^~/([^=]+)?list([0-9]+)?\.aspx$" to="~/$1list.aspx?id=topics$2" processing="stop" />
</rewriter>
rewriter节点中配置重写规则。
再在system.web节点下增加httpModules节点
<httpModules>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter" />
</httpModules>
OK。
现在可以写一个简单的也没测试一下了。
全部源代码和例子,点击下载
将它引用到你的网站中,然后在web.config中的configuration下增加configSections节点和rewriter节点
<configSections>
<section name="rewriter" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<rewriter>
<rewrite url="^~/([^=]+)?list([0-9]+)?\.aspx$" to="~/$1list.aspx?id=topics$2" processing="stop" />
</rewriter>
rewriter节点中配置重写规则。
再在system.web节点下增加httpModules节点
<httpModules>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter" />
</httpModules>
OK。
现在可以写一个简单的也没测试一下了。
全部源代码和例子,点击下载