退出登入方法,清除相關的cookies和session
阿新 • • 發佈:2019-02-12
/// <summary> /// 退出登入 /// </summary> public void LoginOut() { Session.Abandon(); if (Request.Cookies["loginId"] != null && Request.Cookies["pwd"] != null && Request.Cookies["id"] != null) { Response.Cookies["id"].Expires = DateTime.Now.AddYears(-10); Response.Cookies["loginId"].Expires = DateTime.Now.AddYears(-10); Response.Cookies["pwd"].Expires = DateTime.Now.AddYears(-10); } Response.Write("<script> top.location.href='Login.aspx'; </script>"); }