|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
How to: Create an ASP.NET Login Page
You can create a login page using the ASP.NETcontrol. This 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 configuring ASP.NET membership and forms authentication, see .
To create a login page
Create an ASP.NET Web application that uses ASP.NET membership. For details and examples, see.
Create an ASP.NET Web page in your application named Login.aspx.
By default, ASP.NET forms authentication is configured to work with a page named Login.aspx. You can change the default login page name in the Web.config file for your application using theproperty.
Add a Login control to the page.
Optionally set the control'sproperty to the name of the page that the user will be redirected to after logging in. If you do not specify a value for the DestinationPageUrl property, the user will be redirected to the originally requested URL after being authenticated.
The following example shows the markup for a Login control:
<asp:Login ID="Login1" runat="server" DestinationPageUrl="~/MembersHome.aspx"> </asp:Login>