简体   繁体   中英

Classic ASP Response.redirect encoding issue

I have some legacy classic ASP code in vbscript I'm supporting which redirects through to different URLs.

I have one problem with response.redirect on the following URL:

http://www.michelson.pl/kolczyki-z-bialego-zlota-z-2-diamentami-o-szlifie-princess-masy-0-40ct;1363853/

The response.redirect seems to encode the ; to %3B generating the below which is an invalid URL:

http://www.michelson.pl/kolczyki-z-bialego-zlota-z-2-diamentami-o-szlifie-princess-masy-0-40ct%3B1363853/

Any ideas on how I can resolve this?

After a bit more googling it seems there is a possible way around this using the following to create a redirect via headers:

Response.Status = "302 Object Moved"
Response.AddHeader "Location", url
Response.Write "<HTML>"
Response.Write "<BODY>"
Response.Write "This file was moved to "
Response.Write "<A HREF=""" & url & """>here.<A>"
Response.Write "</BODY>"
Response.Write "</HTML>"
Response.End

This creates a successful redirect to http://www.michelson.pl/kolczyki-z-bialego-zlota-z-2-diamentami-o-szlifie-princess-masy-0-40ct;1363853/ with no encoding of the ; to %3B

The problem is the ";". You could split the string of url by ";" and then you can delete the part after ";". I have viewed that the link run too.

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