如何prvent注销后访问该页面? [英] How to prvent visiting the page after logout?

查看:114
本文介绍了如何prvent注销后访问该页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ASP.NET和C#。之后单击注销我使用这一点。

I am using ASP.NET and C#.After click logout i am using this.

Session.Abandon();
Session.RemoveAll();
Page.Responce.Cache.setCacheability(HttpCacheability.NoCache);
Response.Redirect("Default.aspx");

不过这之后,如果他们浏览器中单击后退按钮它要previous页。

But after this if they clicked back button in browser it is going to previous page.

有什么办法prevent呢?

Is there any way to prevent this?

谢谢..

编辑:

我也用这个。

protected void Page_Load(object sender, EventArgs e)
{
    if(!IsPostBack)
    {
        if (Session["LoginId"] == null)
            Response.Redirect("frmLogin.aspx");
        else
        {
            Response.ClearHeaders();
            Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
            Response.AddHeader("Pragma", "no-cache");
        }
    }
}

由于这个他们点击浏览器的后退按钮,然后在页面加载将被称为所以我们可以检查认证会话变量。

Because of this they click browser back button then the pageload will be called so there we can check for the session variable for authentication.

推荐答案

我张贴的链接我希望这个指南,你并帮助你任何你需要点击这里

I am posting a link I hope this guide you and Help you whatever you need click here

http://www.dotnetfunda.com/

这篇关于如何prvent注销后访问该页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆