当我退出时它仍然登录,当我退回它仍然登录 [英] When I logout it still login and when I back it still login

查看:62
本文介绍了当我退出时它仍然登录,当我退回它仍然登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从asp.net页面注销但它仍然登录时,如果我在注销后复制新选项卡中的链接它仍然登录,退出后如果我按下浏览器的按钮它仍然显示登录,

i需要帮助。我添加了注销页面的代码也是plz帮助



我尝试了什么:



When i logout from asp.net page but it still login ,if i copy link in new tab after logout it still login , also after logout if i press back button of browser it still show login,
i need help. i add the code of logout page also plz help

What I have tried:

public partial class logout : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                Session.Clear();


                Session.Abandon();
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                FormsAuthentication.SignOut();
                Session.Remove("LOGINNAME");
                Session.Remove("LOGINPASSWORD");
                Session.Remove("Index");
                Session.Remove("Default");
                Session.Remove("logout");
                Session.Contents.RemoveAll();
                Session.RemoveAll();
                Cache.Remove("LOGINNAME");
                Cache.Remove("LOGINPASSWORD");
                Cache.Remove("AGENTID");

                Response.Cache.SetNoStore();
                Response.Cache.SetNoServerCaching();

                Response.Expires = -1;
                Session.Timeout=1;
                Response.Redirect("Default.aspx", true);
                Response.Flush();
                

            }
        }

推荐答案

一个问题可能是:

One problem could be the :
Response.Redirect("Default.aspx", true);



,因为当你给Response.Redirect赋值为true时

没有说明特定的代码行将被执行....

为了执行


since when you give the value true to the Response.Redirect
nothing bellow that specific line of code will be executed....
In order to execute the

Response.Flush

你必须

赋值false,以便检查下面的任何代码行

Response.Redirect。



您也可以尝试使用

you have to
assign the value false in order to also check for any lines of code beneath
the Response.Redirect.

You could also try to use

Response.End



而不是Response.Flush。 ..

这样就会触发


instead of Response.Flush...
This way the

EndRequest

..


这篇关于当我退出时它仍然登录,当我退回它仍然登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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