Membership role and permission management [3]

Source: Internet
Author: User

Really step into the question.

4. Create the createuserwizard control.

Create An ASPX page in vs2005 named createuserwizard. aspx. Drag a createuserwizard control from the toolbox and set the finishdestinationpageurl attribute. This attribute indicates the target page after you click "continue" after the creation is complete.

<Asp: createuserwizard id = "createuserwizard1" runat = "server" continuedestinationpageurl = "~ /Default. aspx ">
</ASP: createuserwizard>

Currently, no settings are made. You can see it in the design view of vs2005.

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/createuserwizardof8_jyj8wegr5xsw.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/createuserwizardof8_jYJ8WegR5xsW.gif "alt =" "width =" 429 "Height =" 374 ">

Test it first!

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/createuserwizardstep1fv9_8dzpqsluo18c.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/createuserwizardstep1fv9_8DZPqsLUO18C.gif "alt =" "width =" 402 "Height =" 306 ">

Submit. the following result is displayed:

{
If (! This. resized) {return false;} else {window. Open ('attachments/2007/4/27/createuserwizardfinishcy2_zdbbnpv5hv0y.gif ');}
} "Src =" http://www.blueidea.com/articleimg/2007/04/4676/createuserwizardfinishcy2_ZDBbnPV5HV0Y.gif "alt =" "width =" 394 "Height =" 166 ">

Therefore, after Correctly Setting membership, the registered users can use it immediately. This is the default template of createuserwizard. You can also create the template you need, and vs2005 can help you convert it. You can modify it. This is the case after conversion.

<Asp: createuserwizard id = "createuserwizard1" runat = "server" continuedestinationpageurl = "~ /Default. aspx "activestepindex =" 1 ">
<Wizardsteps>
<Asp: createuserwizardstep runat = "server">
<Contenttemplate>
<Table border = "0">
<Tr>
<TD align = "center" colspan = "2">
Register a new account </TD>
</Tr>
<Tr>
<TD align = "right">
<Asp: Label id = "usernamelabel" runat = "server" associatedcontrolid = "username"> Username: </ASP: Label> </TD>
<TD>
<Asp: textbox id = "username" runat = "server"> </ASP: textbox>
<Asp: requiredfieldvalidator id = "usernamerequired" runat = "server" controltovalidate = "username"
Errormessage = "User Name" is required ". "Tooltip =" "User Name" is required ". "Validationgroup =" createuserwizard1 "> * </ASP: requiredfieldvalidator>
</TD>
</Tr>
<Tr>
<TD align = "right">
<Asp: Label id = "passwordlabel" runat = "server" associatedcontrolid = "password"> password: </ASP: Label> </TD>
<TD>
<Asp: textbox id = "password" runat = "server" textmode = "password"> </ASP: textbox>
<Asp: requiredfieldvalidator id = "passwordrequired" runat = "server" controltovalidate = "password"
Errormessage = "A" password "is required ". "Tooltip =" A "password" is required ". "Validationgroup =" createuserwizard1 "> * </ASP: requiredfieldvalidator>
</TD>
</Tr>
<Tr>
<TD align = "right">
<Asp: Label id = "confirmpasswordlabel" runat = "server" associatedcontrolid = "confirmpassword"> Confirm Password: </ASP: Label> </TD>
<TD>
<Asp: textbox id = "confirmpassword" runat = "server" textmode = "password"> </ASP: textbox>
<Asp: requiredfieldvalidator id = "confirmpasswordrequired" runat = "server" controltovalidate = "confirmpassword"
Errormessage = "you must enter the" Confirm Password ". "Tooltip =" you must enter "Confirm Password ". "Validationgroup =" createuserwizard1 "> * </ASP: requiredfieldvalidator>
</TD>
</Tr>
<Tr>
<TD align = "right">
<Asp: Label id = "emaillabel" runat = "server" associatedcontrolid = "email"> Email: </ASP: Label> </TD>
<TD>
<Asp: textbox id = "email" runat = "server"> </ASP: textbox>
<Asp: requiredfieldvalidator id = "emailrequired" runat = "server" controltovalidate = "email"
Errormessage = "you must enter" email ". "Tooltip =" you must enter "email ". "Validationgroup =" createuserwizard1 "> * </ASP: requiredfieldvalidator>
</TD>
</Tr>
<Tr>
<TD align = "right">
<Asp: Label id = "questionlabel" runat = "server" associatedcontrolid = "Question"> Security Prompt: </ASP: Label> </TD>
<TD>
<Asp: textbox id = "Question" runat = "server"> </ASP: textbox>
<Asp: requiredfieldvalidator id = "questionrequired" runat = "server" controltovalidate = "Question"
Errormessage = "you must enter" security prompt ". "Tooltip =" you must enter "Security Prompt question ". "Validationgroup =" createuserwizard1 "> * </ASP: requiredfieldvalidator>
</TD>
</Tr>
<Tr>
<TD align = "right">
<Asp: Label id = "answerlabel" runat = "server" associatedcontrolid = "Answer"> Security answer: </ASP: Label> </TD>
<TD>
<Asp: textbox id = "Answer" runat = "server"> </ASP: textbox>
<Asp: requiredfieldvalidator id = "answerrequired" runat = "server" controltovalidate = "Answer"
Errormessage = "a" security answer "is required ". "Tooltip =" you must enter "Security answer ". "Validationgroup =" createuserwizard1 "> * </ASP: requiredfieldvalidator>
</TD>
</Tr>
<Tr>
<TD align = "center" colspan = "2">
<Asp: comparevalidator id = "passwordcompare" runat = "server" controltocompare = "password"
Controltovalidate = "confirmpassword" display = "dynamic" errormessage = "" password "and" Confirm Password "must match. "
Validationgroup = "createuserwizard1"> </ASP: comparevalidator>
</TD>
</Tr>
<Tr>
<TD align = "center" colspan = "2" style = "color: Red">
<Asp: literal id = "errormessage" runat = "server" enableviewstate = "false"> </ASP: literal>
</TD>
</Tr>
</Table>
</Contenttemplate>
<Mnmnavigationtemplate>
<Table border = "0" cellspacing = "5" style = "width: 100%; Height: 100%;">
<Tr align = "right">
<TD align = "right" colspan = "0">
<Asp: button id = "stepnextbutton" runat = "server" commandname = "movenext" text = "create user"
Validationgroup = "createuserwizard1"/>
</TD>
</Tr>
</Table>
</Customnavigationtemplate>
</ASP: createuserwizardstep>
<Asp: completewizardstep runat = "server">
<Contenttemplate>
<Table border = "0">
<Tr>
<TD align = "center" colspan = "2">
Finished </TD>
</Tr>
<Tr>
<TD>
You have successfully created your account. </TD>
</Tr>
<Tr>
<TD align = "right" colspan = "2">
<Asp: button id = "continuebutton" runat = "server" causesvalidation = "false" commandname = "continue"
TEXT = "continue" validationgroup = "createuserwizard1"/>
</TD>
</Tr>
</Table>
</Contenttemplate>
</ASP: completewizardstep>
</Wizardsteps>
<Startnavigationtemplate>
<Asp: button id = "startnextbutton" runat = "server" commandname = "movenext" text = "Next"/>
</Startnavigationtemplate>
<Finishnavigationtemplate>
<Asp: button id = "finishpreviusbutton" runat = "server" causesvalidation = "false" commandname = "moveprevious"
TEXT = "previous"/>
<Asp: button id = "finishbutton" runat = "server" commandname = "movecomplete" text = "complete"/>
</Finishnavigationtemplate>
<Stepnavigationtemplate>
<Asp: button id = "steppreviusbutton" runat = "server" causesvalidation = "false" commandname = "moveprevious"
TEXT = "previous"/>
<Asp: button id = "stepnextbutton" runat = "server" commandname = "movenext" text = "Next"/>
</Stepnavigationtemplate>
</ASP: createuserwizard>
 

5. log on to the login control.

Createuserwizard can be directly dragged out for use, and the same is true for the login control. Put a login in the page, and the code is very simple.

<Asp: Login ID = "login1" runat = "server" destinationpageurl = "~ /Admin/default. aspx "passwordrecoverytext =" retrieve password "passwordrecoveryurl =" passwordrecovery. aspx ">
</ASP: Login>

Attribute explanation:
Destinationpageurl: Set the URL of the page displayed to the user when the logon attempt is successful.
Passwordrecoverytext: Set the text of the password recovery Page Link.
Passwordrecoveryurl: Specifies the URL of the password recovery page. If you forget your password, click this link to retrieve it.

 

Classic forum discussion:
Http://bbs.blueidea.com/thread-2740354-1-1.html

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.