Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

Assigning Roles at User Creation

$
0
0

Hello,

This is a topic that I have seen a lot of matrial on, but a lot of the solutions go beyond what I need. Even my most basic code is not working and I cannot figure out why.

I wish to add a role to a user at the user creation, using the Create User Wizard.

The user creates alright, but it does not assign the role? Can anyone shed some light on what the problem is, please?

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatedUser="CreateUserWizard1_CreatedUser"><WizardSteps><asp:CreateUserWizardStep runat="server" /><asp:CompleteWizardStep runat="server" /></WizardSteps></asp:CreateUserWizard>


public partial class Committee_CreateNewUser : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
        {

        }


    protected void CreatedUser(object sender, EventArgs e)
        {

        }


protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
        {
        Roles.AddUserToRole(CreateUserWizard1.UserName, "Member");


        }


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>