网上关于注销登出的代码越来越少了,贴出之前在网上找到的一段代码,为不熟悉该段代码的同行们减少找资料的些许时间,共勉!
//Session.RemoveAll();
Session.Clear();
Session.Abandon();
Response.Clear();
Response.Buffer = true;
Response.Expires = 0;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
Response.AddHeader("pragma", "no-cache");
Response.AddHeader("cache-control", "private");
Response.CacheControl = "no-cache";
Response.Write("<script language=/"javascript/"> top.location.href=/"login.aspx/";</script>");