我正在开发一个网页。我的问题是,当用户单击注销按钮时,他们被转移到登录屏幕。但是,如果他们在登录屏幕上单击返回,则允许他们直接返回上一个屏幕。我想防止这种情况的发生,因为不应允许他们这样做。
这是我登出页面的代码。
public partial class Logout : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session.Clear();
Session.Abandon();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
try
{
Session.Abandon();
FormsAuthentication.SignOut();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1000;
Response.CacheControl = "no-cache";
//Response.Redirect("login.aspx", true);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
Response.Redirect("~/Login.aspx");
}
}
}