0
以下是我的代码。在会话处理中运行良好。但问题是,当我点击主页面上的注销按钮,我得到一个错误:线程中止异常。从邮件页面到注销页面
System.Threading.ThreadAbortException:线程被中止。
如何redirect
返回登录页面,如果我按一下从母版注销按钮需要帮助..
下面的代码是从我的主aspx
文件,该文件是masterpage
。
protected async void Page_Load(object sender, EventArgs e)
{
if (Session["mail"] == null)
{
Response.Redirect("~/login.aspx", false);
Context.ApplicationInstance.CompleteRequest();
}
else
{
await Task.Run(() => retrivelast());
}
}
下面是母版页注销事件
protected void LinkButton2_Click(object sender, EventArgs e)
{
Session.Abandon();
HttpContext.Current.Session.Clear();
HttpContext.Current.Session.Abandon();
HttpContext.Current.Response.Cookies.Add(new HttpCookie("mail", ""));
Response.Redirect("login.aspx");
}
哪里linkbutton2_click是我注销事件的代码。