Solved

CreateUserWizard Add to role

Posted on 2008-10-15
4
1,198 Views
Last Modified: 2013-12-17
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
Comment
Question by:caoimhincryan
  • 3
4 Comments
 
LVL 3

Accepted Solution

by:
sajain84 earned 500 total points
ID: 22719592
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
 

Author Closing Comment

by:caoimhincryan
ID: 31506247
Perfect.Thanks.
0
 

Author Comment

by:caoimhincryan
ID: 22719748
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
 

Author Comment

by:caoimhincryan
ID: 22719762
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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question