asp.net会话和安全性 [英] asp.net session and security

查看:74
本文介绍了asp.net会话和安全性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我编写了一个asp.net项目,当用户登录到其个人页面然后注销时,我使用了会话登录页面的某些部分,然后单击返回"按钮.浏览器,然后用户返回他的个人页面!如何防止这种情况?

hello guys , I have written an asp.net project , I have used session to some parts of pages such as login , when a User sign in to his personal page and then log out ,and after that clicks the back button in Browser , the User then return back to his personal page !! How can I prevent this ??

推荐答案


如果您使用的是asp.net成员资格提供程序,则需要调用此函数:
Hi,
If you are using asp.net membership provider then you need to call this:
FormsAuthentication.Signout();
FormsAuthentication.RedirectToLoginPage();


如果您愿意,也可以使用


If you want you can destroy session too using

Session.Abandon();


破坏会话.不允许用户进入个人页面,将history.forward()添加到页面的body onload事件中
If you want to keep the user on the same page and not let the user go to personal page, add history.forward() to body onload event to the page
<body  onload="history.forward()">


在这里,请查看此提示/技巧

注销后浏览器后退按钮问题 [
Here you go, check this Tip/Trick

Browser back button issue after logout[^]


这篇关于asp.net会话和安全性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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