如何防止未经授权的用户访问特定的网站页面 [英] How to prevent UnAuthenticated Users from access to specific Site Pages

查看:107
本文介绍了如何防止未经授权的用户访问特定的网站页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我的网站中,任何人都可以通过在浏览器地址中写入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表单身份验证"的信息.

http://msdn.microsoft.com/en-us/library/ff647070.aspx
Have a look at below link for information on "Asp.Net Forms Authentication".

http://msdn.microsoft.com/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.


好像在这里读了很多^ _ ^.那是我以前的问题,在这里找到了解决方法.

http://www.4guysfromrolla.com/webtech/110701-1.shtml [ ^ ]
http://www.4guysfromrolla.com/webtech/LearnMore/Authentication.asp [ ^ ]
基本上只要遵循这些步骤,您就会学到很多东西


编程愉快!
Look like a lot of reading here ^_^. that is my problem before and got a solution here.

http://www.4guysfromrolla.com/webtech/110701-1.shtml[^]
http://www.4guysfromrolla.com/webtech/LearnMore/Authentication.asp[^]
Basically Just follw the steps and you colud learn a lot


Happy Programming!!


这篇关于如何防止未经授权的用户访问特定的网站页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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