Search code examples
asp.netrolescreateuserwizard

Adding a user to a default role


I want every person that registers in my website to be added to a default role "Users", question is how do I do it? :D

This is my register.aspx code:

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="register.aspx.cs" Inherits="register" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <form id="register1" runat="server"><center><b><asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 
  ContinueDestinationPageUrl="~/default.aspx" AnswerLabelText="תשובה סודית:" 
        CompleteSuccessText="המשתמש נוצר בהצלחה!" 
        ConfirmPasswordCompareErrorMessage="הסיסמאות חייבות להיות שוות." 
        ConfirmPasswordLabelText="וודא סיסמא:" CreateUserButtonText="הירשם" 
        EmailLabelText="כתובת דואר אלקטרוני:" PasswordLabelText="סיסמא:" 
        QuestionLabelText="שאלה סודית:" UserNameLabelText="שם משתמש:">
  <WizardSteps>
    <asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server" Title="הרשמה">
    </asp:CreateUserWizardStep>
    <asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
    </asp:CompleteWizardStep>
  </WizardSteps>
</asp:CreateUserWizard></b></center></form>
</asp:Content>

Thanks to anyone who helps!! :)


Solution

  • Nevermind, I used Roles.AddUserToRole(), thanks anyway!