您的位置:首页 > 其它

退出登录,清除Session

2009-03-27 09:17 218 查看

退出登录,清除Session

1 protected void Button1_Click(object sender, EventArgs e)
2 if (Session["UserName"] != null)
4 Session.Remove("UserName");
6 Session.RemoveAll();
7 Response.Cookies["UserName"].Expires = DateTime.Now;
8 }
9 Page.RegisterStartupScript("","<script>window.top.document.location.href='index.aspx';</script>");
10 }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: