Login Controls[1]->Login
The Login control provides the user interface to log a user into a web site. The Login control uses the Membership service to authenticate the user in your membership system. The default Membership service from your configuration file will be used automatically, however you can also set the Membership provider that you would like used as a property on the control. The Login Control consists of:
- Username Label and Textbox: Collects the string used to identify the user in the membership system.
- Password Label and Textbox: Collects the password for the specified user. The textbox text is always obscured.
- LoginButton: The button to submit the user's request for authentication.
- RememberMe: Configurable to display a checkbox giving the user the option to store a persistent cookie on the user's machine.
- Title and Instruction: Text to orient and guide the user through the process.
- Links: Configurable links to help, password recovery and user registration information.
- Validators: Required field validators for the username and password textboxes.
Simple Login Sample
This sample demonstrates the default Login control behavior on a dedicated login page as defined in the forms authentication section of web.config.Login Behaviors
The Login control supports a variety of options to customize the display behaviors. Some of the behaviors that will impact the display are:- Orientation: Determines if the control will be oriented horizontally or vertically. Horizontal is a useful option when you want the login functionality to always be present in the top or bottom of a page.
- TextLayout: Determines if the text will be displayed on top of the textboxes or on the side.
- VisibleWhenLoggedIn: When set to true, the control will be hidden on the page if the user is already authenticated. This option works well on home pages that provide personalized data when the user is logged in to the website. Note: If the Login control is on the default login page set in the configuration file this property will be ignored and the control will always be rendered.
Login Behaviors Sample
This sample demonstrates a horizontal Login control with the text displayed above the textboxes.Login Styles
The Login control supports customizing the look of the control through a series of style properties that control different areas of the control.- Control Style: Applies to all sections of the Login control and is merged with other styles set on the control.
- Label Style: Applies to the username and password labels.
- TextboxStyle: Applies to the username and password textboxes.
- TitleTextStyle: Applies to the title text.
- InstructionTextStyle: Applies to the instruction text.
- HyperlinkStyle: Applies to the help, password recovery and create new user links.
- LoginButtonStyle: Applies to the login button.
- CheckBoxStyle: Applies to the remember me checkbox.
- FailureTextStyle: Applies to the text returned if the membership system fails to authenticate the user.
- ValidatorTextStyle: Applies to the text displayed if the required field valuators fail.
Login Styles Sample
This sample demonstrates a variety of the style properties.Login Templates
The Login control is a composite control which unites child controls (e.g. textboxes, buttons) and additional logic (calling Membership, handling errors) to implement the login functionality. For even more control over the display of the Login control you can template the control. To ensure that the Login control continues to function when it is templated, your control must use well known control IDs or command names for its child controls. In addition to the key controls required for functionality (e.g. textboxes) additional controls with well known IDs are supported and will be automatically hooked up to the Login functionality. Here is a list of control IDs and command names that are used in template editing mode:- ID=UserName
- ID=Password
- ID=RememberMe
- ID=FailureText
- CommandName=Login This control can have any control ID but must support command bubbling.



浙公网安备 33010602011771号