今天在网上搜索了半天也没有找到好的解决方法,现在用这个基本上可以使用asp.net2.0防后退功能
问题重现:
用户点击登出按钮(button1)后,仍然可以后点击IE上面的后退按扭后退到此页面,并没有RedirectToLoginPage;
解决方法:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class controlCenter_systemMange_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
if (!User.Identity.IsAuthenticated)
FormsAuthentication.RedirectToLoginPage();
}
protected void Button1_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}
}