How can I get the role description from the ASP.NET membership database, other than querying the database directly?
Asked
Active
Viewed 2,612 times
2 Answers
4
I did look around using Reflector but didn't see any method that returns the description. The method CreateRole()
only takes the rolename. Even the stored procedure aspnet_Roles_GetAllRoles
only returns the name. I'm afraid you'll need to query the aspnet_Roles table directly

edosoft
- 17,121
- 25
- 77
- 111
-
1http://msdn.microsoft.com/en-us/library/aa478950.aspx says description is currently unused. – Greg Oct 06 '09 at 16:42
1
To provide details, because the Description field is not natively supported, when defining roles, I supplied a custom database call taking advantage of the description field in the aspnet_Roles table created.
Specifically, I created the role using the built-in ASP.net CreateRole method
Roles.CreateRole("CREATED ROLE");
and then used direct SQL to update the ASP table using the following SQL command.
UPDATE dbo.aspnet_Roles SET [Description]='MY ROLE DESCRIPTION' WHERE RoleName='CREATED ROLE'
When I need to use the role description, I do a select
SELECT [Description] FROM dbo.aspnet_Roles where RoleName='CREATED ROLE'

Andrew Barber
- 39,603
- 20
- 94
- 123

John Kroetch
- 1,143
- 8
- 15