Improve company productivity with a Business Account.Sign Up

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

CreateUserWizard Add to role

Hi,

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?
0
caoimhincryan
Asked:
caoimhincryan
  • 3
1 Solution
 
sajain84Commented:
Hey!

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

0
 
caoimhincryanAuthor Commented:
Perfect.Thanks.
0
 
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 asp.net configuration page under security?

0
 
caoimhincryanAuthor Commented:
I have asked another question if you want to have a look...

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_23816104.html
0
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