1
Answer

setting a defaultrole for createuserwizard.

Ask a question
Mark Uy

Mark Uy

14y
3k
1
i am trying to implement a access rules to my website. what im trying to figure out is how to set a default role for my main createuserwizard control on my default page. i want to set it to role type "customer" as default.

problem is i cant figure out how to make it work.

i tried a simple event-based code to capture the user name and tie it onto a role:

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

it doesnt seem to work.

my other option was to tie it onto a button click event instead:

 protected void ContinueButton_Click(object sender, EventArgs e)
{
Roles.AddUserToRole(User.Identity.Name, "customer");
Response.Redirect("redirectpage.aspx");

}


again, to no avail. the check box for "customer" is still blank on the web admin page.

please help!

Answers (1)