简体   繁体   English

经典ASP Response.redirect编码问题

[英]Classic ASP Response.redirect encoding issue

I have some legacy classic ASP code in vbscript I'm supporting which redirects through to different URLs. 我在vbscript中支持一些传统的经典ASP代码,该代码会重定向到不同的URL。

I have one problem with response.redirect on the following URL: 我对以下URL的response.redirect有一个问题:

http://www.michelson.pl/kolczyki-z-bialego-zlota-z-2-diamentami-o-szlifie-princess-masy-0-40ct;1363853/ 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 ; response.redirect似乎编码; to %3B generating the below which is an invalid URL: %3B生成以下无效URL:

http://www.michelson.pl/kolczyki-z-bialego-zlota-z-2-diamentami-o-szlifie-princess-masy-0-40ct%3B1363853/ 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 ; 这会成功重定向到http://www.michelson.pl/kolczyki-z-bialego-zlota-z-2-diamentami-o-szlifie-princess-masy-0-40ct;1363853/ ,而没有编码; to %3B 至%3B

The problem is the ";". 问题是“;”。 You could split the string of url by ";" 您可以用“;”分割url字符串 and then you can delete the part after ";". 然后您可以删除“;”之后的部分。 I have viewed that the link run too. 我认为链接也可以运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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