Solved

Configuring membership wizard to assign specific role when account is created in ASP 2.0

Posted on 2007-11-19
5
340 Views
Last Modified: 2013-12-17
I have a site with 3 membership roles  admin, management, and user.  I’m using ASP.Net 2.0.  Can someone direct me,  to a tutorial that will show me how to configure the membership wizard so it will set all new members to the user role only? Or show me how I can do this?

Thanks for any help!
0
Comment
Question by:bmanmike39
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:Mortaza Doulaty
ID: 20317944
You can add user to role using:

Roles.AddUserToRole("username","rolename")

You can use this code in the events of user created.
0
 
LVL 27

Accepted Solution

by:
Sammy earned 500 total points
ID: 20318318
0
 
LVL 27

Assisted Solution

by:Sammy
Sammy earned 500 total points
ID: 20318337
you should always check if the user exists in this role before adding them
you can do that by checking if the UserIsInRole which is a method you can  override IsUserInRole(string username, string rolename) the method should return a bool value of course
more on the method and an example implementation can be found here

http://msdn2.microsoft.com/en-us/library/system.web.security.roleprovider.isuserinrole(vs.80).aspx
0
 
LVL 12

Expert Comment

by:Mortaza Doulaty
ID: 21123820
>>Split: Mortaza_doulaty {http:#20317944} & sammy1971 {http:#20318318}
So where are my points?
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

786 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