如何在注销后限制网页访问 [英] How to restrict web page access after logout

查看:71
本文介绍了如何在注销后限制网页访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友



我有一个查询相关的安全性并在注销后限制网页访问。还有一件事,有时候用户会复制URL并粘贴到另一个浏览器中,但它会出现一些错误。



但我希望当用户做这些类型的事情然后它将自动重定向到登录页面。请尽快帮助我。



提前感谢所有人。

Dear Friends

I have a query related security and restrict webpage access after logout. And one more thing, sometimes user copy the URL and paste into another browser and it works with some error.

But I want when user do these types of things then it will automatically redirect to login page. Please help me out as soon as possible.

Thanks in advance to all.

推荐答案

-To禁用返回按钮试试这个:

1.在页面加载事件中的母版页中写入此代码

-To Disable back button try this:
1.Write this code in master page in page load event
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();





2.在头部的登录页面中写下此代码


and
2.Write this code in login page in head section

<script type="text/javascript">
window.history.forward(-1);
</script>





- 通过使用 URL 试试这个:

用户通过身份验证后,创建一个指示该对象的会话对象。在每个页面中检查该会话对象是否具有经过身份验证的值。

类似于:



-To restrict the User by accessing pages using URL try this:
After a user is authenticated, create a session object indicating that. In every page check if that session object has the authenticated value.
Something like:

//In the login page, after user is authenticated
Session["validated"] = true;
 
//In every page that requires authentication, On page load event, check
if(Session["validated"] == null)
    Response.Redirect("Login.aspx");
else
    //do what you want here.


看看这个提示:退出后退出按钮问题 [ ^ ]
Have a look at this tip: Browser back button issue after logout[^]


这篇关于如何在注销后限制网页访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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