注销后处理浏览器后退按钮 [英] Handling browser back button after logout

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

问题描述

从网站注销并按浏览器后退按钮时,将再次显示最后一页,但我想将其重定向到 login.aspx 页.我该怎么办?

When I logout from my website and press browser back button, then the last page is displayed again, but I want to redirect it to login.aspx page. How can I do it?

推荐答案

由于缓存而发生这种情况.

清除缓存,使浏览器没有历史记录(这将使浏览器中的后退/前进"按钮变为灰色).
清除缓存的代码可以放在下面的代码中:

This happens because of Cache.

Clear the cache such that browser has no history (this will make back/forward button in browser grayed out disabled.)
The code for clearing cache can be put up in code behind as follows:

// Code disables caching by browser. Hence the back browser button
// grayed out and could not causes the Page_Load event to fire 
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();



您可以将类似的东西添加为aspx格式:



You can add something similar in form aspx if you want to place it there:

<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">



就像我上周回答了您一样,希望这不是重新发布,并且可以为您解决问题.



Just feels like I answered you this last week, hope it''s not a re-post and this solves the problem for you.


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

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