开发者

Regex issue in rewriter config

开发者 https://www.devze.com 2022-12-31 17:45 出处:网络
I\'m having an issue with bad request开发者_C百科s from certain search parameters. An example URL:

I'm having an issue with bad request开发者_C百科s from certain search parameters.

An example URL:

http://www.foo.com/washington/forums/search/%26

Results in a bad request.

The rewriter config line looks like this:

<rewrite url="^(.*)/forums/search/(.*)" to="~/Pages/Forums/Overview.aspx?Address=$1&amp;q=$2" processing="stop" />

I'm thinking it's an issue with the Regex...?

Thanks in advance!


%26 is url-encoded &

So the query string of the rewritten URL becomes Address=www.foo.com/washington&q=& which is not well-formatted due to the trailing &

I think you'll have to encode the string before passing to the url-rewriter


Issue and solution discussed here:

http://dirk.net/2008/06/09/ampersand-the-request-url-in-iis7/

0

精彩评论

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