Membership roles question

J

John

Hi

I am using the login control with a custom membership provider. My question
is; once the user has logged in how do I programmatically check what roles
the user belongs to, to provide the user with the relevant features?

Thanks

Regards
 
S

S. Justin Gengo

John,

Dim AllRoles() As String = System.Web.Security.Roles.GetAllRoles()

Dim StringBuilder As New System.Text.StringBuilder

For Each Role As String In AllRoles

If Me.User.IsInRole(Role) Then

StringBuilder.Append(Role & "<br>")

End If

Next

Response.Write(StringBuilder.ToString)


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
J

Joshua Flanagan

Page.User.IsInRole("theRoleImTestingFor");

Or use the static methods on the Roles class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top