Re: IsInRole methid is not working as expected



Should work - you can use this page for troubleshooting:

http://www.leastprivilege.com/content/binary/ShowContexts21.zip
-----
Dominick Baier (http://www.leastprivilege.com)

Hi,

I created a local group on server and added my self to that group.

I am using the following code in my web page to check the membership
of the loggedin user against the Windows group on the same server.

User.IsInRole(@'MachineName\groupName') . The above always return me
false. If i restart my machine then this returns true. Any clue why?

MachineName - is same as the server name on which the code is being
run.

Windows Authentication is enabled and i checked the User.Identity and
that is coming correct and as expected. Subsequently i want to extend
this to check for some thing like DOMAIN\WINDOWSGROUP.

Thanks in advance.



.



Relevant Pages

  • Re: SQL Local Account Permission - Read Only on System Tables and
    ... Create a Windows group on the domain and have your developer logins added to ... VIEW SERVER STATE to that one login. ... can create your own server-level roles) and grant it VIEW SERVER STATE ...
    (microsoft.public.sqlserver.security)
  • Re: Need help on how to organize users and objects
    ... Security is a huge subject in SQL Server 2005, so I'd suggest you to spend ... Create two Windows Group (Dev and Viewers) ... database A and 6-9 tables in Database B you can assign explicity GRANT ...
    (microsoft.public.sqlserver.security)
  • Re: IsInRole methid is not working as expected
    ... the page also shows the roles of the user as seen from ASP.NET - is the windows group you want to check against in this list?? ... Dominick Baier ... I created a local group on server and added my self to that group. ... Any clue why? ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • DomainLocalServer$ is not a valid user
    ... The login account is member of a Windows group that is dbowner of both ... without the a BEGIN TRANSACTION it works ... Server user 'Domain\LocalServer$' is not a valid user in database 'db_A'. ...
    (microsoft.public.sqlserver.security)
  • Re: Q: Local Admin account and SA account
    ... configurations. ... windows group is a granted access to the server. ... refers to the local Administrators group. ...
    (microsoft.public.sqlserver.server)