如何让用户登录后无法返回到之前未登录的页面?有可能吗?
最佳答案
在 C# 中试试这个
public void disablebrowserbackbutton()
{
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoServerCaching();
HttpContext.Current.Response.Cache.SetNoStore();
}
客户端
<script type="text/javascript">
function preventBack() {
window.history.forward();
}
setTimeout("preventBack()", 0);
window.onunload = function() {
null
};
</script>
关于c# - 在 c# asp.net 中登录后禁用 Web 浏览器后退按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19971719/