我们如何使用浏览器的后退停止网页视图signout后 [英] How can we stop web page view after signout using browser back

查看:205
本文介绍了我们如何使用浏览器的后退停止网页视图signout后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在ASP.NET网站。我们有两种类型的登录
1.用户
2.管理员

I am having web site in ASP.NET. We have two type of login 1. Users 2. Administrator

我测试过程中面临的问题,以下

I am facing following problem during testing

问题陈述:假设我通过用户登录的loggedIn和浏览的所有页面,让在用户的任何页面上说,我点击退出按钮,它会重定向我在登录页

Problem statement: Suppose i loggedin by user login and surf all pages, let say at any page of user i click on logout button, it will redirect me at login page.

现在的问题是当我使用浏览器的后退,它让我的用户的页面,但是在实际我应该无法注销后查看该页面。

Now the problem comes when i use browser back, it shows me user's page But in actual i should not able to view that page after logout.

我的功能正确的,因为如果我注销后页面上点击它会再次在登录页面重定向我,但我的问题是注销后使用浏览器回来,我不应该在userpage降落。
[由于发生在谷歌和雅虎]

My functionality is proper because if i click on page after logout it will again redirect me at login page, but my problem is i should not land on userpage using browser back after logout. [As happens in Google and Yahoo]

同样是发生与管理员登录。

Same is happening with Admin login.

请帮我理清的问题。

推荐答案

您必须设置我猜以下

Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
Response.Cache.SetValidUntilExpires(false);
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();

这将导致您的网页后背部还当用户presses后退按钮因此您可以检查他是否仍然登录,并在重定向的情况下,以他的其他一些地方。

This will cause your page to post back also when the user presses the back button and so you're able to check whether he's still logged in and in case redirect him to some other place.

这篇关于我们如何使用浏览器的后退停止网页视图signout后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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