点击退出登陆,跳转到该页,下面是该页的page_load代码
private void Page_Load(object sender, System.EventArgs e) { Session[Constants.Agent_KEY] = null; Session[Constants.WebUser_KEY] = null; if(Request.Cookies[Constants.Agent_COOKIES]!=null) { Response.Cookies[Constants.Agent_COOKIES].Expires = DateTime.Now; Response.Cookies[Constants.Agent_COOKIES].Value = ""; } if(Request.Cookies[Constants.WebUser_COOKIES]!=null) { Response.Cookies[Constants.WebUser_COOKIES].Expires = DateTime.Now; Response.Cookies[Constants.WebUser_COOKIES].Value = ""; } Response.Redirect("../../index.aspx");//清空后,跳转到您想到的页面 }
百家号 互联网微风说
微信公众号 weisico-com
转载请注明:微思考学习网-关注技术,分享知识 >> 退出登陆清空session和cookie