Solved

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now