我正在为我的网站创建一个url rewriter.net规则而压力很大。
我有一个链接
http://localhost/Pages/CategoryList.aspx?ID=2&Page=1我想把它换成这个
http://localhost/Category/2.aspx?Page=1我尝试了以下几种方法:
<rewrite url="~/Category/(.+).aspx?Page=(.+)" to="~/Pages/CategoryList.aspx?ID=$1&Page=$2" /> 但它并没有起作用。
有人能帮我吗?
发布于 2009-12-30 22:25:39
这将会起作用
<rewrite url="~/Category/(.+).aspx(\?(.*))?" to="~/Pages/CategoryList.aspx?ID=$1&$3" />发布于 2009-10-15 00:54:24
试试这个:
<rewrite url="~/Category/([0-9]+)\.aspx\?Page=([0-9]+)" to="~/Pages/CategoryList.aspx?ID=$1&Page=$2" />或者更好(更短):
<rewrite url="~/Category/(d+)\.aspx\?Page=(d+)" to="~/Pages/CategoryList.aspx?ID=$1&Page=$2" />我在想“。”你正在使用的是太贪婪和匹配太多。
发布于 2009-10-14 21:13:53
你有没有补充:
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
</httpModules>到你的web.config文件吗?
https://stackoverflow.com/questions/1569001
复制相似问题