0

当我点击注销按钮时,点击浏览器用户的后退按钮后一切都会好起来的。这也很好。(但是,没有事件点击母版页;工作很好)

并且,任何事件都像搜索项一样被点击(我的意思是使用选择查询或通过按钮点击获取数据)

Session.clear();注销按钮工作不好...它像普通页面一样工作;即当我单击注销时...使用&重定向到主页Redirect.Response("page.aspx")

使用此代码,在母版页 page_load 后面:

if (!IsPostBack)
        {

            if (Session["name"] == null)
            {

                Response.Redirect("Default.aspx");
            }

            else
            {

                Response.ClearHeaders();

                Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");

                Response.AddHeader("Pragma", "no-cache");

                Label1.Text = "WELCOME" + " " + Session["name"];


            }

现在我想在不使用 javascript 的情况下禁用后退按钮,因为原因是当有人停止浏览器的 javascript ....同样的问题发生..

4

1 回答 1

2
private void Page_Load(object sender, EventArgs e)
    {
        // Put user code to initialize the page here
        if (Session["SessionId"] == null)
        {
            Response.Redirect("Login.aspx"); 
        }


        Response.Buffer=true;
        Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
        Response.Expires = -1500;
        Response.CacheControl ="no-cache";

    }
于 2012-08-27T10:02:26.067 回答