简体   繁体   English

如何限制用户不登录

[英]how to restrict the user without login

i created some pages in asp.net. 我在asp.net中创建了一些页面。 but i want to allow the users only if he is login. 但我只允许用户登录。 how to do that. 怎么做。 is there any controls available for that one. 是否有适用于该控件的控件。 Thank you 谢谢

In the web.config there is a section below <system.web> where you can add: web.config中, <system.web>下有一个部分可以添加:

<authorization>
    <deny users="?" />
</authorization>

It is normal that you put pages that requires login in a certain sub-directory and thus you can put a new web.config in that folder with the above lines inside <system.web> , this will prevent unauthorized access. 通常,您将需要登录的页面放在某个子目录中,因此可以在该文件夹中放置一个新的web.config ,其中上述行位于<system.web> ,这将防止未经授权的访问。

MSDN has a great section about Forms Authentication that I recommend you to read. 我建议您阅读MSDN中有关表单身份验证的重要部分

Yes, you need a login page that uses Forms Authentication. 是的,您需要使用表单身份验证的登录页面。

See details here 在这里查看详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM