Mixed authentication in ASP.NET 2.0 - Roles

Discussion in 'ASP .Net Security' started by Enrico De Majorca, Dec 19, 2006.

  1. Working solution:

    Web Config:

    <roleManager enabled="true" cacheRolesInCookie="true"


    <add name="WindowsProvider"
    description="Retrieves roles data from the Windows authenticated token
    for the request"/>



    <identity impersonate="true"/>
    <authentication mode="Windows" />

    Global asax.cs:

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

    string[] myRoles = _RolePrincipal.GetRoles();
    Enrico De Majorca, Dec 19, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.