Re: Problem checking user's role

From: Alfred Gary Myers Jr. (alfred_myers_at_hotmail.com)
Date: 06/21/04


Date: Mon, 21 Jun 2004 14:56:06 -0300

Hi Geoffrey,

You shouldn't be using ConfigurationSettings.AppSettings("stic\ISSAdmins")
inside IsInRole unless it's a key in the config file that returns the actual
domain and group names.

Try something like

If User.IsInRole("stic\ISSAdmins") Then
         cbOverrideLimit.Enabled = True
End If

Or if ConfigurationSettings.AppSettings("stic\ISSAdmins") should be
returning the actual domain and group names check it to se if it's returning
the correct value.

HTH

Alfred Gary Myers Jr.
www.yuma.com.br

"Geoffrey Pennington" <penningtong@stic2.comNOSPAM> wrote in message
news:u%23yGXQ6VEHA.2972@TK2MSFTNGP12.phx.gbl...
> I am using ASP.Net and Visual Studio2003 on an XP Professional development
> machine. The web application I am developing needs to behave a little
> differently for users who are members of the ISSAdmins group. I created
this
> group, and made myself a member of it, on our domain server (which runs
> Windows 2000). Then, in the VB code, I wrote:
>
> If User.IsInRole(ConfigurationSettings.AppSettings("stic\ISSAdmins")) Then
> cbOverrideLimit.Enabled = True
> End If
>
> where "stic" is our domain name. The "IF" tests false and I don't know
why.
>
> After reading that I need to cast the User object to a WindowsIdentity
> object I tried
> 1. Adding "Imports System.Security.Principal" to the beginning of the
code,
> and
> 2. changing the"IF" to
> Dim WUser As WindowsIdentity = User
> If WUser.IsInRole(ConfigurationSettings.AppSettings("CanOverride")) Then
>
> This code gave me a syntax error saying "IsInRole is not a member of
> WindowsIdentity." I made WUser a WindowsPrincipal object, which got rid of
> the syntax error but the code still tests false.
>
> Can anyone tell me what the problem is? I know the system knows my user ID
> because I can obtain it from User.Identity.Name and display it on the
> screen.
>
>



Relevant Pages

  • Re: Have half working
    ... post all in a second post. ... "true" for all of the IsInRole calls. ... WindowsIdentity wi = Context.User.Identity; ... IdentityReferenceCollection sids = wi.Groups; ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Problem checking users role
    ... all the local groups in it, and a lot of entries are NOTHING. ... the isinrole function is taking a long time and it is always ... IsInRole is a member of the IPrincipal interface which ... > implemented by the WindowsPrincipal class, not the WindowsIdentity class. ...
    (microsoft.public.dotnet.security)
  • Problem checking users role
    ... I am using ASP.Net and Visual Studio2003 on an XP Professional development ... group, and made myself a member of it, on our domain server (which runs ... After reading that I need to cast the User object to a WindowsIdentity ... the syntax error but the code still tests false. ...
    (microsoft.public.dotnet.security)
  • Re: Have half working
    ... IsInRole() is still failing inside my ASP.NET app. ... WindowsIdentity.GetCurrent() will always return a WindowsIdentity ... IPrincipal user = Thread.CurrentPrincipal; ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: IsInRole performance issue
    ... I didn't implement my own WindowsIdentity but if I had to implement from ... You will be looking for the DevelopMentor Security Utilities link. ... > how your IsInRole implementation works? ... >> your domain controller. ...
    (microsoft.public.dotnet.security)