身份验证注销和后退按钮 asp .net
我的 asp.net 页面有问题
我们正在使用表单身份验证。 页面退出后,我可以返回到上一页。 这是由于浏览器中缓存的页面造成的。
所以我禁用了缓存。 但这也有其自身的缺点。
- 如果用户登录,他将无法使用后退按钮导航到上一页,因为浏览器中没有可用的缓存。
- 如果我在页面中有文件下载,由于缓存被禁用,它将无法工作。
即使history.back javascript函数也不是正确的解决方案。
这个问题的永久解决方案是什么? 我一直面临这个问题,但从未找到一致的解决方案。
谁能为此建议一个可能的解决方案?
谢谢 国民账户体系
I have a problem in my asp.net pages
We are using form authentication. Once page is signed out I am able to go back to the previous page. This is due to pages cached in browser.
So i disabled the cache. But this has its own drawbacks.
- If user is logged in he will not be able to navigate to the previous page using back button since no cache available in the browser.
- if I have a file download in the page it wont work since cache disabled.
Even history.back javascript function also not the correct solution.
What is a permanent solution for this problem? I have faced with this all the time and never found a consistent solution.
Can anyone suggest a possible solution for this?
Thanks
SNA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要禁用缓存。 如果您使他们的会话或身份验证票无效,您应该能够检测他们是否已注销,在这种情况下您可以重定向他们。 此链接可能会有所帮助。 如果您确实关心后退按钮,请尝试在注销客户端后通过 JavaScript 清除客户端历史记录。
编辑
查看此链接 它深入探讨了一些不同的方法。 我认为没有一种可靠的方法可以阻止用户查看以前下载的内容,但是您可以采取一些措施来使其变得困难。
You shouldn't need to disable caching. If you invalidate their session or authticket, you should be able to detect if they are signed out or not, in which case you can redirect them. This link may be helpful. If you are really concerned with the back button try using clearing the clients history via javascript after you log them out.
EDIT
Check out This Link It goes in depth on some of the different approaches. I don't think there is a sure fire way of keeping users from looking at previously downloaded content, but there are a few things you can do to make it difficult.