IsInRole does not seem to work

From: RDufour (rdufour_at_sgiims.com)
Date: 09/15/03


Date: Mon, 15 Sep 2003 13:52:51 -0400


The following code

Dim myUser As System.Security.Principal.WindowsIdentity

Dim winPrincipal As New
System.Security.Principal.WindowsPrincipal(System.Security.Principal.Windows
Identity.GetCurrent())

Dim username As String = winPrincipal.Identity.Name

If winPrincipal.IsInRole("Users") Then

'OK

Else

'Not OK

End If

Always returns NOT OK even though while debugging I can see my username
correctly I can go to the local administration on my server that I develop
om (w2k- SP4) see that my username Bob is part of users administrators and
part of Users. No matter what usergroup I write in (checking capitalization
is same) the isinRole function never returns True.

Can anyone tell me what's wrong?

Thanks in advance,

Bob



Relevant Pages

  • Re: Usernametoken cant beused inweb services that are invoked bywebcl
    ... you still use the built-in username token manager which can only handle windows accounts - you have to register your own in web.config ... Dim aa As String Dim bb As String ... SoapException("Missing security token", SoapException.ClientFaultCode) ... apEnvelope envelope) at ...
    (microsoft.public.dotnet.security)
  • Re: WSE 3.O Web Service with ASP.Net Client using VB.Net
    ... <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"</a>;> ... ''' Constructs an instance of this security token manager. ... Dim principal As GenericPrincipal = New ... There is a logon page which takes a Username and Password, ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Return Value?
    ... Public Class UserDetails ... Public FirstName As String ... Public Function Login(ByVal UserName As String, ... Dim sqlCmd As SqlCommand ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: IsInRole does not seem to work
    ... > Dim winPrincipal As New ... > Always returns NOT OK even though while debugging I can see my username> correctly I can go to the local administration on my server that I develop> om see that my username Bob is part of users administrators and> part of Users. ...
    (microsoft.public.dotnet.security)
  • Re: Modifying AD User attribute
    ... Would you haapened to have a script to do the following: ... username in AD with username in the spreadsheet, ... Dim objRootDSE, strDNSDomain, strNetBIOSDomain ... ' Determine DNS domain name from RootDSE object. ...
    (microsoft.public.windows.server.scripting)