C# 清楚Cookies
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C# 清楚Cookies相关的知识,希望对你有一定的参考价值。
//销毁Cookies中的数据 if (Request.Cookies["Ticket"] != null) { HttpCookie mycookie; mycookie = Request.Cookies["Ticket"]; TimeSpan ts = new TimeSpan(0, 0, 0, 0);//时间跨度 mycookie.Expires = DateTime.Now.Add(ts);//立即过期 Response.Cookies.Remove("Ticket");//清除 Response.Cookies.Add(mycookie);//写入立即过期的 Response.Cookies["Ticket"].Expires = DateTime.Now.AddDays(-1); } Response.Cookies["AccountId"].Expires = DateTime.Now; Response.Cookies["LoginName"].Expires = DateTime.Now; Response.Cookies["Password"].Expires = DateTime.Now; Response.Cookies["Email"].Expires = DateTime.Now; Response.Cookies["LoginMobileNum"].Expires = DateTime.Now; Response.Cookies["SubSiteLoginName"].Expires = DateTime.Now; Response.Cookies["SubSitePassword"].Expires = DateTime.Now;
以上是关于C# 清楚Cookies的主要内容,如果未能解决你的问题,请参考以下文章