浏览器后退按钮注销后禁用问题 [英] Browser Back Button Disable issue after logout

查看:80
本文介绍了浏览器后退按钮注销后禁用问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有一个页面控制器类,从中继承了所有页面。并且这个班级检查会话并处理它们。



现在我面临一个问题,如果我登录在我的应用程序中,让我们说从 page1 我点击退出,



我将被重定向到 Login.aspx 如果会话还活着,或者 Login.aspx?SessionExpired 如果会话已过期。



但在这两种情况下,如果我按下浏览器的后退按钮,它只会重定向到 Page1



我已阅读并尝试了许多文章,包括CP上的以下内容。



浏览器后退按钮问题



与Sandeep



但仍然发生了同样的事情。我试图清除一个页面的缓存,而不是让用户从这个页面注销,比预期的,它被重定向到 Login.aspx?QueryString ,但当我推动从浏览器返回按钮,这个页面显示...... :(即使我清除了它的缓存。



编辑:



i have a page controller class in my application from which all the pages are inherited. and this class checks for the session and handle them.

Now I am facing an issue, if i log in to my application, and let say from page1 i click signout,

I will be redirected to Login.aspx if session was alive or to Login.aspx?SessionExpired if session has been expired.

But in both the cases, if i press Browser's back button, it simply redirects to Page1.

I have read and tried many articles including the following on CP.

Browser Back button Issue

and By Sandeep.

but still same is happening. I tried to clear cache of one page and than put user to logout from this page, than as expected, it was redirected to Login.aspx?QueryString, but when i push the back button from browser, again this page shows... :( even though I cleared its cache.



protected void Page_Load(object sender, EventArgs e)
    {
//trying the above mentioned link code to clear the cache of current page.
Response.Buffer= true;
Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
Response.Expires =-1500;
Response.CacheControl = "no-cache";

//calling the session handling controller class
//page is inherited from this page.
  base.Page_Load(sender, e);

//MY COde here
}









任何人都可以给我一些想法???





Can anybody give me some idea???

推荐答案

嗨Vick,



这可以使用HTTP模块处理。



Hi Vick,

This can be handled using the HTTP module.

Create a HTTP Module File
Refer the HTTP Module File in your web.config
so when ever the application loads any page this maodule will be included in the Page life cycle process, so that you can check for the proper user authorization & Authenticatinthrough some session or cookie data if the user pressed logout, probably you may cleared those cookie / session values.



此HTTP模块文件将检查值是否为值为null然后自动将页面重定向到Login.aspx或指定的页面。





注意:HTTP模块文件将在Page之前调用加载所有页面。



实施HTTP模块 [< a href =http://support.microsoft.com/kb/307996target =_ blanktitle =新窗口> ^ ]



谢谢!


This HTTP Module File, will check for the values if the values are null then automatically redirects the page to Login.aspx or the page specified.


Note: HTTP Module File will be called before Page Load of all pages.

Implementing HTTP Module[^]

Thanks!


我在我的Page控制器类中添加以下代码并且它像魅力一样工作后,我已经解决了这个问题。



感谢 YogeshwarBK108 ,根据以下文章发表的评论帮助了我很多。



在从Asp.Net注销时禁用浏览器的后退功能





:)
I have solved this by my self after adding the following code in my Page controller class and its working like a charm.

Thanks to YogeshwarBK108, from whom comment under the following article helped me alot.

Disabling browser's back functionality on sign out from Asp.Net


:)


这篇关于浏览器后退按钮注销后禁用问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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