Home All Groups Group Topic Archive Search About
Author
18 Dec 2005 1:52 PM
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

Author
18 Dec 2005 3:30 PM
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
Show quoteHide quote
"John" <John@nospam.infovis.co.uk> wrote in message
news:uYPaJp9AGHA.3064@TK2MSFTNGP10.phx.gbl...
> 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
>
>
Author
19 Dec 2005 12:41 AM
Joshua Flanagan
Page.User.IsInRole("theRoleImTestingFor");

Or use the static methods on the Roles class.