?
Solved

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

Posted on 2007-11-19
5
Medium Priority
?
354 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
4 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 Ageil earned 2000 total points
ID: 20318318
0
 
LVL 27

Assisted Solution

by:Sammy Ageil
Sammy Ageil earned 2000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

862 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