[英]Persistent Cookie in Classic ASP
I am having an issue with keeping persistent cookies. 我遇到了保持持久性cookie的问题。
Problem: 问题:
With below code, I am able to create a cookie and keep it during the entire browser session. 使用下面的代码,我可以创建一个cookie并在整个浏览器会话期间保留它。 However, when I close the browser the cookie is removed after a few seconds. 但是,当我关闭浏览器时,cookie会在几秒钟后被删除。
Points that have been checked: 已检查的点数:
So I've got the following code in classic ASP: 所以我在经典ASP中有以下代码:
Response.Cookies("user").expires= DateAdd("m",1,now())'looks like: 5/29/2014 3:53:13 PM'
Response.Cookies("user")("org")=request("org")
In short: My persistent Cookie keeps getting removed! 简而言之: 我的持久Cookie一直被删除!
Any help would be greatly appreciated. 任何帮助将不胜感激。
Solution to the problem: The browser was configured to "Delete browsing history on exit" , which included the removal of cookies. 解决问题的方法:浏览器配置为“退出时删除浏览历史记录” ,其中包括删除Cookie。
This option overrides any settings to keep cookies. 此选项会覆盖任何保留cookie的设置。
try this way: 试试这种方式:
Response.Cookies("user").expires= DateAdd("m",1,now())
if request("org")<>"" then
Response.Cookies("user")("org")=request("org")
end if
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.