Solved

CreateUserWizard Add to role

Posted on 2008-10-15
4
1,202 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

734 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