Re: WindowsPrincipal.IsInRole() problem with non-builtin roles

From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 08/30/04


Date: Mon, 30 Aug 2004 09:29:04 -0500

When using Windows authentication in ASP.NET, the WindowsPrincipal for the
logged in user is in the HttpContext.User property, not the
WindowsIdentity.GetCurrent(). They are the same IF you are impersonating,
but otherwise they are not.

HTH,

Joe K.

"naijacoder naijacoder" <naijacoder@toughguy.net> wrote in message
news:urYFE4ljEHA.3536@TK2MSFTNGP12.phx.gbl...
> Can't get WindowsPrincipal.IsInRole() to work for me when using
> Windows Authentication. Here's a snippit of code from my C#
> codebehind page:
>
> WindowsPrincipal wp = new WindowsPrincipal(
> WindowsIdentity.GetCurrent() );
> lblUser.Text = wp.Identity.Name;
> Label1.Text = wp.IsInRole(@"DOMAIN\group").ToString();
>
>
> where "DOMAIN\group" is a valid group name. The username shows up
> correctly as "DOMAIN\username" but for any non-builtin roles,
> IsInRole() returns false. Does anyone have suggestions as to why this
> is not working?
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: General questions about LDAP, GC and access permissions
    ... Windows Communication Foundation) they are authenticated with the regular ... this is done by examing what groups the user is a member of. ... Since the regular windows authentication is used, ... trusted domain in an external forest. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Help please to authenticate Windows users
    ... status error code as well as Win32 error code -- I know the HTTP status code ... Windows Authentication automatically works if the machines are joined to the ... Is VS.Net on the same machine as IIS ...
    (microsoft.public.inetserver.iis.security)
  • Re: Intermittent access to web site secured with Windows authentication
    ... Marcus ... > Windows Authentication is connection-based and not delegatable. ... > various elements of Internet networking that can prevent Windows ... > likely work in your access scenario. ...
    (microsoft.public.inetserver.iis.security)
  • Re: Intermittent access to web site secured with Windows authentication
    ... Windows Authentication is connection-based and not delegatable. ... When you try to access it from home (i.e. Internet scenario), ... in after multiple login prompts. ...
    (microsoft.public.inetserver.iis.security)
  • Re: Custom authentication in a web application
    ... On the server we create our own principal object ... > Any reason for using Windows Authentication here rather than any of the ... >>two overloads of IsInRole to use our own security check. ...
    (microsoft.public.dotnet.framework.webservices)