(i) Login
In ASP.net 2.0, many new features and controls have been added. Among them, the new landing controls make Web applications design more handy. What is a login control? Is that we usually use in the Web application of the user registration, login, forget the password, after landing according to the different rights and display different pages, and so on, now in ASP.net 2.0 can be implemented by the control provided.
In ASP.net 2.0, a new framework membership is introduced to make it easier to create and manage users, as well as password-protect pages in WEB applications. The new framework contains additional features to handle authentication and authorization that can meet the needs of both Web site administrators and developers. Web site administrators can leverage new Web site Administration tools to create new users and roles, and control access to pages in Web applications. The Web Site Administration tool is a set of predefined ASP. NET pages, users who do not have programming skills can use them to configure WEB applications. Using the membership API, programmers can easily use the drag control method, and then a small number of code, you can fully implement the user, role permissions, and so on, can also be customized to expand.
1. Create a website project
2.ASP. NET Configuration
Security settings options are divided into three parts: users, roles, and rules.
Logon authentication can be configured to be based on forms and windows.
3. Using the Login control
Description: After the user log in, display the "Exit" prompts, through the LoginStatus control to achieve. In the control's properties, there are logoutaction and logoutpageurl two properties that can be used to set the logout to simply refresh the current page, move to a page, or turn to the login page.
How to set Loginpageurl (Login page), when running the program, when you press the login link displayed by this control, always go to the login.aspx under the root folder, and the actual login file is/login/login.aspx. How to solve?
Check the data, the original login URL is set in the web.config. If you are using form to authenticate the login, the default web.config is written like this:
<system.web>
<authentication mode="Forms" />
</system.web>
needs to be modified as follows:
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/member/login.aspx"></forms>
</authentication>
</system.web>