Solved

CreateUserWizard Add to role

Posted on 2008-10-15
4
1,199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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.
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…

726 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