asp.net membership - can roles be added to the new user control?
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
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.
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!!
精彩评论