本文介绍了如何删除 ASP.NET 网站上的 cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的网站中,当用户单击注销"按钮时,Logout.aspx 页面会加载代码 Session.Clear().
In my website when the user clicks on the "Logout" button, the Logout.aspx page loads with code Session.Clear().
在 ASP.NET/C# 中,这是否会清除所有 cookie?或者是否需要添加任何其他代码来删除我网站的所有 cookie?
In ASP.NET/C#, does this clear all cookies? Or is there any other code that needs to be added to remove all of the cookies of my website?
推荐答案尝试类似的方法:
if (Request.Cookies["userId"] != null) { Response.Cookies["userId"].Expires = DateTime.Now.AddDays(-1); }但使用
Session.Abandon();除了在许多情况下.
更多推荐
如何删除 ASP.NET 网站上的 cookie
发布评论