开发者

URL ReWriter for .NET

I am using this, but I have some hard to solve problems.

This is part of my code:

 <rewrite url="/Dictionary/(.+)/(.+)" to="~/Dictionary.aspx?page=$2&amp;&amp;word=$1"/>
 <rewrite url="/Dictionary" to="~/Dictionary.aspx"/>    

When I type links like mywebsite.com/Dictionary/cat/4 the site loads only mywebsite.c开发者_如何学编程om/Dictionary.


Just a guess. Your second condition matches everything starting with /Dictionary. You probably want this

/Dictionary/?$


Just a suggestion but you can also try out IIS Url Rewrite 2 instead.


URL Rewrite 2 is a good option like XII said, comes with an user interface.

Regarding the regex, it would be more efficient for the regex engine to avoid backtracking; use the following expression instead:

"/Dictionary/([^/]+)/([^/]+)"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜