Regex issue in rewriter config
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&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/
精彩评论