如何防止未经授权的用户访问特定的网站页面

编程入门 行业动态 更新时间:2024-10-13 00:33:59
本文介绍了如何防止未经授权的用户访问特定的网站页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 在我的网站中,任何人都可以通过在浏览器地址中写入url来访问特定页面, 如何防止只有经过身份验证的用户才能访问这些页面? 谢谢

Hi every body, In my website, any one can access specific pages by write url in Browser Address, How to prevent that where these pages are not allowed for any one but for Authenticated users only? Thanks

推荐答案

请查看下面的链接,以获取有关" Asp.Net表单身份验证"的信息. msdn.microsoft/en-us/library/ff647070.aspx Have a look at below link for information on "Asp.Net Forms Authentication". msdn.microsoft/en-us/library/ff647070.aspx

如果您希望拥有自己的安全模型,而不是Microsoft提供的安全模型,则进行用户控制并检查 If you want to have your own security model other than the one provided by Microsoft, then make a user control and check the Session["LoggedIn"]

variable,位于

variable , in

OnLoad

事件处理程序中,以查看用户是否已登录;如果他尚未登录,则将他重定向到登录页面. 在登录页面中,如果用户成功登录,则将

event handler ,to see if the user is logged in or not; if he had not logged in then redirect him to login page. In login page if the user logged in successfully set the

Session["LoggedIn"]

设置为true. 将此用户控件放置在要对其进行限制的每个页面中,或者可以将其放置在母版页中以对所有页面应用限制,而无需将其放置在每个单独的页面中.

to true. Place this user control in every page you want to have restriction in it, or you can place it in master page to apply restriction to all pages without the need to place it in each individual page.

好像在这里读了很多^ _ ^.那是我以前的问题,在这里找到了解决方法. www.4guysfromrolla/webtech/110701-1.shtml [ ^ ] www.4guysfromrolla/webtech/LearnMore/Authentication.asp [ ^ ] 基本上只要遵循这些步骤,您就会学到很多东西 编程愉快! Look like a lot of reading here ^_^. that is my problem before and got a solution here. www.4guysfromrolla/webtech/110701-1.shtml[^] www.4guysfromrolla/webtech/LearnMore/Authentication.asp[^] Basically Just follw the steps and you colud learn a lot Happy Programming!!

更多推荐

如何防止未经授权的用户访问特定的网站页面

本文发布于:2023-11-11 05:32:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577519.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:未经授权   如何防止   页面   用户   网站

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!