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();
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();