Use of asp.net2.0 login controls (three common methods)

Source: Internet
Author: User
Asp.net| Control

Here, take CreateUserWizard as an example to illustrate the general use of the Registered User Wizard
1 Using the default Wizard control features
The default Registration Wizard uses a simple wizard that is as simple as one sentence code:
<asp:createuserwizard id= "Createuserwizardcontrol" runat= "Server"/>
No additional code is required to complete the user's registration and write the registered information to the ASPNETDB.MDF database.

2 Use Default ID
Some restless users are beginning to be unsatisfied with the above features: although simple, but too inflexible, inflexible, for example, in the user name, I want to verify that the user name must be a letter or a number, this time using the above code can not be completed, so have to use the template, perhaps similar code similar to the following:

<asp:createuserwizard id= "Createuserwizardcontrol" runat= "server"
  <wizardsteps>
   <asp:createuserwizardstep id= "CREATEUSERWIZARDSTEP1" runat= "Server" title= "account Details:" >
  <CONTENTTEMPLATE>
  User Name:
 <asp:textbox runat= "Server" id= "UserName" > </asp:textbox></span>
    <asp:requiredfieldvalidator runat= "Server" Controltovalidate= "UserName" validationgroup= "Createuserwizardcontrol"
     errormessage= "User name is required." tooltip= "User name is required." Id= "usernamerequired"
        display= "Dynamic"
    </asp:requiredfieldvalidator>


Password: <asp:textbox runat= "Server" textmode= "Password" id= "Password" cssclass= "Register_password" ></asp :textbox>
Confirm Password: <asp:textbox runat= "Server" textmode= "Password" "id=" ConfirmPassword "cssclass=" Register_ Password "></asp:TextBox></span>
</WizardSteps>
... ...
</asp:CreateUserWizard>

When using the above code, please note the ID of the system default definition, for example, the ID of the user name using a textbox can only be username, and the ID of the textbox used by the password can only be password. ...
Of course, you can go to MSDN to see CreateUserWizard more predefined IDs.

3) Custom ID
Maybe some people are not satisfied, why do I have to use Microsoft predefined ID, I want to let the user ID is myname, the password ID is mypassword, if you use a custom ID, the system will not be able to identify, Then you need to get the text value of MyName and mypassword yourself. The specific treatment is more complicated. Because you need to do the following steps
1> Get user Name
2> Get the password
3> Connection Database
4> writes input to the database
5> shut down the database
As you can see, without the predefined features of the system, your workload will increase significantly. This is no longer explained in detail here.



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.