怎么编码? response.cookie with asp classic - vbscript?

时间:2017-03-06 18:23:07

标签: cookies vbscript asp-classic

我试图设置一个值为/ sv / en的cookie,并且/最终像cookie中的%2F一样,所以我想知道如何编码或者你需要做什么来编写/而不是。

我现在用它来设置cookie。

 Response.Cookies("googtrans")="/sv/en"
 Response.Cookies("googtrans").path = "/"
 Response.Cookies("googtrans").expires = "2038-01-01 10:00"
 Response.Cookies("googtrans").domain = ".mypage.se"

那么如何在cookie中写/?非常感谢!

2 个答案:

答案 0 :(得分:1)

通过Response.Cookies集合URL编码(反之亦然URL解码)是隐式的。

为防止这种情况发生,您需要设置一个原始cookie,而不是Response.AddHeader

Response.AddHeader "Set-Cookie", "googtrans=/sv/en; expires=2038-01-01 10:00; domain=.mypage.se; path=/"

答案 1 :(得分:0)

您无法使用ASP更改此行为,因为它是浏览器的功能。

Cookie由浏览器以这种方式存储/传输,因为Cookie是通过标头中的HTTP进行通信的。斜杠根据URLEncoding模式进行编码。