How to: Create an ASP.NET Login Page

You can create a login page by using the ASP.NET login control. The control consists of text boxes, a check box and a button control. The text boxes collect username and password information from the user. The check box is used to remember the user's credentials and the button is used to submit the information the user provides. The login control simplifies creating login pages for form authentication. This login control takes a user name and password and uses ASP.NET membership and forms authentication to verify the user's credentials and create an authentication ticket. For information about how to configure ASP.NET membership and forms authentication. If a user selects the Remember me next time check box, the control creates a persistent cookie that remembers the user's credentials.

The login control functions as expected when you create an ASP.NET Web site with membership, configure membership, and create a membership user.

To create a login page

  1. Create an ASP.NET Web application that uses ASP.NET membership.

  2. Create an ASP.NET Web page named Login.aspx in your application.( By default, ASP.NET forms authentication is configured to use a page named Login.aspx. You can change the default login page name in the Web.config file for your application using the Login Url property.)
  3. Add a Login control to the page.
  4. Set the control's Designation page Url property to the name of the page that the user will be redirected to after they log in. For example, you can set the DestinationPageUrl property to DestinationPageUrl="~/Membership/MembersHome.aspx", a members only page. If you do not specify a value for the Designation Page Url property, the user will be redirected to the original page the user requested after successfully logging in.
  5. The following example shows the markup for a Login control:

0 Responses to "How to: Create an ASP.NET Login Page"