简体   繁体   中英

IIS URL Rewrite Module : Rewrite Appends QueryString

I have the following rewrite rule.

 <rule name="cheapbastardz.signupcode" stopProcessing="true">
     <match url="^signup/code/([_0-9a-z-%=\+\$]*)$" />
     <conditions>
     </conditions>
     <action type="Rewrite" url="Page.aspx?sc={R:1}" appendQueryString="false" />
 </rule>

Now when the user click on a buton where the page is posted back the url changes from

http://localhost/CBAanmelding/signup/code/3f69fa28-5c6c-4815-a2b3-3c846651bed9

to

http://localhost/CBAanmelding/signup/code/3f69fa28-5c6c-4815-a2b3-3c846651bed9?sc=3f69fa28-5c6c-4815-a2b3-3c846651bed9

I don't want the querystring to appear. How can I prevent this. Thanks in advance.

Gr

Martijn

use

form1.Action = Request.RawUrl;

Are you sure your rule is firing?

The match pattern does not seem to fit the incoming URL. The incoming URL begins with /CBAanmelding , while your pattern looks for URLs that bbegin with signup. The circumflex preceding the word signup is a zero-width assertion that the pattern matches only at the beginning of the URL.

Maybe you need to change the pattern?

 <rule name="cheapbastardz.signupcode" stopProcessing="true">
     <match url="^CBAanmelding/signup/code/([_0-9a-z-%=\+\$]*)$" />
     <conditions>
     </conditions>
     <action type="Rewrite" url="Page.aspx?sc={R:1}" appendQueryString="false" />
 </rule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM