Mixed authentication in ASP.NET 2.0 - Roles

E

Enrico De Majorca

Working solution:


Web Config:

<system.web>
<roleManager enabled="true" cacheRolesInCookie="true"
defaultProvider="WindowsProvider">

<providers>

<add name="WindowsProvider"
type="System.Web.Security.WindowsTokenRoleProvider"
description="Retrieves roles data from the Windows authenticated token
for the request"/>

</providers>

</roleManager>

<identity impersonate="true"/>
<authentication mode="Windows" />
</system.web>


Global asax.cs:

WindowsIdentity ident = WindowsIdentity.GetCurrent();
WindowsPrincipal princ = new WindowsPrincipal(ident);
RolePrincipal _RolePrincipal = new RolePrincipal(ident);

string[] myRoles = _RolePrincipal.GetRoles();
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top