urlrewriter issue: Query string is duplicated show

2019-04-15 07:14发布

问题:

I'm using urlRewritingNet. My web.config is here>>

<add name="HOME" virtualUrl="^~/(.*)/Default.aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/Default.aspx?PageTitle=$1" ignoreCase="true"/>

My query string is here:

www.domain.com/home/default.aspx

This works. But I'm insert LoginStatus control. When click on the login control to logout, Page url was like this www.domain.com/home/default.aspx?PageTitle=home

Request.Querystring["PageTitle"] result is home,home

How to stop this duplicated query string?

回答1:

I came across the same problem, I did something like following;

change your destinationUrl to "~/Default.aspx/$1"

and catch it with Request.PathInfo.Substring(1);