Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1213
  • Last Modified:

CreateUserWizard Add to role


When I to add a user to my system using CreateUserWizard, I want the user to be added to the role Administrators I created.

I have it set that the AddUser aspx page can only be accessed by an Administrator so only an administrator can add another administrator.

Any ideas?
  • 3
1 Solution

This is what you need to do:
In the wzdRegister_CreatedUser method, you add the following code:

(Considering that your CreateWizard control is called wzdRegister)

string[] usernames = new string[1];
usernames[0] = wzdRegister.UserName;
Roles.AddUsersToRole(usernames, "Administrator");

Open in new window

caoimhincryanAuthor Commented:
caoimhincryanAuthor Commented:
Thanks.That worked. Do you know is it possible to set a user as active or inactive from an aspx page? Try get something similar like in the configuration page under security?

caoimhincryanAuthor Commented:
I have asked another question if you want to have a look...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now