Solved

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

Posted on 2007-11-19
5
343 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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 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