简体   繁体   English

在删除指定域的Cookie时出现问题

[英]Issue Deleting Cookies with Domain specified

I am setting a message cookie when users logout from a sub-domain (pm.skor.in), and then redirecting to the main domain (skor.in). 当用户从子域(pm.skor.in)注销,然后重定向到主域(skor.in)时,我正在设置消息cookie。

On getting to skor.in, the cookie is displayed to the user thanking them for logging out. 进入skor.in时,该cookie将显示给用户,感谢他们注销。

The issue I am having is that the cookie never goes away. 我遇到的问题是cookie永远不会消失。

Here's the code: 这是代码:

If Request.Cookies("msg") IsNot Nothing AndAlso Request.Cookies("msg").Value.Length > 0 Then
    Response.Write("<div class=""notification msginfo"">")
    Response.Write("<a class=""close""></a>")
    Response.Write("<p>" & Request.Cookies("msg").Value & "</p>")
    Response.Write("</div>")
    Response.Cookies("msg").Value = String.Empty
    Response.Cookies("msg").Domain = ".skor.in"
    Response.Cookies("msg").Expires = DateAdd(DateInterval.Year, -1, Date.Now)
End If

As you can see, I am setting the cookie's value to be blank, as well as making it expire yesterday, yet whenever I navigate to another page on skor.in, the message appears, and checking the browser cookies, it still exists. 如您所见,我将cookie的值设置为空,并使其在昨天到期,但是,每当我导航到skor.in上的另一个页面时,都会出现该消息,并检查浏览器cookie,它仍然存在。

Sorry. 抱歉。 I'm a tool. 我是工具

The issue was that I was not setting the domain on logging out. 问题是我没有在注销时设置域。

thanks anyways 不管怎么说,多谢拉

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

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