如何限制用户点击浏览后退和前言按钮 [英] how to restrict user on click on browse back and foreword button

查看:80
本文介绍了如何限制用户点击浏览后退和前言按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用asp.net使用c#代码。当我在测试应用程序时,我观察到我在下面提到的场景。



我登录应用程序,成功登录后我已重定向到主页。当我在主页上,我点击浏览器后退按钮。点击后退按钮,我已重定向到应用程序登录页面。当我在登录页面并点击浏览器froward按钮。点击Froward按钮,我直接重定向到主页,无需登录。



我试图限制用户。请给我任何相同的解决方案。



对于应用程序,我使用菜单扩展的主页面是除登录和注销外的内容页面。

在此先感谢



问候,

Chetan C

Hi,

i am using asp.net by using c# code. While i am testing application i observe scenario that i have mention below.

I am login the application, after successful login i had redirect to home page. while i am on home page and i had click on browser "back" button. On click on back button i had redirect to application login page. while i am on login page and click on browser "froward" button. On click on "Froward" button i had directly redirected to the home page without login.

I am try to restrict user. Please provide me any solution on the same.

For application i use Master page for Menu reaming are content pages except login and logout.
Thanks in advance

Regards,
Chetan C

推荐答案

你'在浏览器缓存中检索页面时会看到这一点,因此您的代码(包括身份验证检查)未运行。您可以通过在希望用户进行身份验证的页面上禁用缓存来停止此操作(谷歌如何在aspx页面上禁用缓存),但这会对您网站的性能产生负面影响并增加资源使用量,因此这取决于您决定它是否值得。毕竟当这个人回去时,他们只是看到他们已经看过的东西,所以谁在乎呢?



你不能阻止人们使用back \但是,这是一个错误的树木。
You're seeing this as the pages are being retrieved from the browser cache so your code (including authentication checks) isn't running. You can stop this by disabling caching on pages you want the user to be authenticated to access (google for how to disable caching on an aspx page), but it will adversely affect the performance of your site and increase resource usage so it's up to you to decide if it is worth it. After all when the person goes back\forward they are simply seeing things they have already seen, so who cares?

You can't stop people using back\forward though, it's the wrong tree to be barking up.


这篇关于如何限制用户点击浏览后退和前言按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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