URLRewriter.net with multiple querystring separated by /
I have been looking around the site a bit, but I didn't find any replies on how to do it the way I want.
What I want is an URL like this:
www.example.com/Projects/"querystring1 - text only"/"querystring2 - 4 digits only"/
to show the page with this URL:
www.example.com/Projects.aspx?Region=querystring1&Zip=querystring2
What I have been trying is the following:
<rewrite url="~/Leje-og-udlejning-arbejdskraft/(.+)/(.+)" to="~/Workers.aspx?Region=$1&zip=$2"/>
But it just takes both of them as one querys开发者_JS百科ting and put them in the Region-querystring.
I'd need to see the rest of your rewrite rules to be sure, but if you have multiple rewrites (i.e. to handle situations where users only specify one of the two query strings) neglecting to add processing="stop"
at the end will cause one rule to override the other.
For example, I use the following setup in my web.config file:
<rewriter>
<rewrite url="~/(.+)/(.+)" to="~/Default.aspx?ref=$1&page=$2" processing="stop"/>
<rewrite url="~/(.+)" to="~/Default.aspx?ref=$1" processing="stop"/>
</rewriter>
This will first check to see if 2 query variables are present. If they are, it rewrites them appropriately and stops processing other rules. This is the biggie. Without processing="stop"
at the end, I end up passing both as the ref
query string. This might be the conflict you're running in to.
精彩评论