Forms-based authentication in ASP. NET web

Source: Internet
Author: User

If you want to use forms to verify the files in a directory or a file, follow these steps:

Add the following configuration section under the <configuration> section of Web. config:

1 <Location Path = "frmregister. aspx"> <! -- If the path here is a folder, the files in the folder do not need to be verified. For example, if Path = "public", all files in public are not verified, if Path = "pubilc/index. aspx "indicates public/index. aspx file not verified -->
2 <system. Web>
3 <authorization>
4 <allow users = "*"/>
5 </authorization>
6 </system. Web>
7 </location>

In the <system. Web> Configuration section, add the following configuration section: 1 <Authentication mode = "forms">
2 <forms name = ". loginuser" loginurl = "default. aspx" Protection = "all" timeout = "30"/>
3 </authentication>
4 <authorization>
5 <deny users = "? "/>
6 <allow users = "*"/>
7 </authorization>

The verification results can be achieved. The code is very simple and will not be explained.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.