views:

33

answers:

2

hi folks,

I'm using the asp built in membership controls, etc. There is a new user control that I wanting to use but this doesn't seem to give the option to set the roles for the user. Anyone know of how I can achieve this?

-- Billy

A: 

Whenever I have used the roles system I have had to run the Built-in Config Editor from within Visual Studio. To do this I select the Config Editor project and then click the icon in the top of the Solution Explorer window with hover text of "ASP.NET Configuration".

This is not an ideal solution but we spend a reasonable amount of time trying to host the config editor behind windows authentication security but with little help.

From in the config editor you can add roles and assign people to those roles too.

I am hoping people have a better answer to this as something that has bugged me in the past!!

ArtificialGold
Yeah that's what I'm doing at the moment. bit of a pain really isn't it!
iamjonesy
Very much a pain!Only think I have ever considered was trying to write my own additional stored procedures but seemed a real pain and against the whole point of it.Since all that pain I have generally avoided Membership as much as possible as the fiddling about just didn't seem worth the time saving.
ArtificialGold
+1  A: 

The basic idea is to use the System.Web.Security.Roles class and manually recreate the ASP.NET Configuration application yourself.

For example, you can use the Roles.GetAllRoles() method to populate a dropdown or checkboxlist. You can use the Roles.AddUserToRole() method to assign roles to users.

Greg
this worked thanks! didnt know about the membership methods! thanks!this link helped me out http://msdn.microsoft.com/en-us/library/system.web.security.roles.addusertorole.aspx
iamjonesy
I'm glad my pointers helped. I've added your link to my answer.
Greg