退出后退

时间:2012-12-07 16:37:31

标签: c# asp.net

如果用户从后面的按钮访问该页面,我希望页面自动退出。

下面是我的代码:

protected void Page_Load(object sender, EventArgs e)
{
    Label1.Visible = false;  
    try
    {
        if (!IsPostBack)
        {
            TxtLogin.Focus();
            Session["url"] = null;

            Response.Cache.SetNoStore();
            Response.Expires = -1;
            Session.Abandon();

            if (Page.User.Identity.IsAuthenticated)
            {
                FormsAuthentication.SignOut();
                Response.Redirect("~\\LoginPage.aspx", false);
            }
        }
    }
    catch (Exception ex) { throw new Exception(ex.Message); }
}

它在IE中工作但是没有在firefox中工作如何为firefox做什么?

1 个答案:

答案 0 :(得分:0)

你将无法做到。 Firefox,当您按下后退按钮时,不会像IE那样重新查询服务器,它只是“记住”页面的整个状态并恢复到该状态。请注意,如果用户尝试关注任何新链接,或者尝试再次尝试再次访问服务器,则无法在用户注销时使用。