HttpContext.Current.User.IsInRole(string) always returns false

R

Randy

I have a asp.net 1.1 site and
HttpContext.Current.User.IsInRole(@"MyLocalComputer\MyGroup") always returns
false.

I've turned off anonymous access in iis, set the impersonate=true in the
web.config, even tried to impersonate via code using this. I've tried this
on XP Pro as well as 2003 server with the same results.

System.Security.Principal.WindowsImpersonationContext
impersonationContext;
impersonationContext =

((System.Security.Principal.WindowsIdentity)HttpContext.Current.User.Identit
y).Impersonate();

WindowsPrincipal myPrincipal =
(WindowsPrincipal)HttpContext.Current.User;

bool rc = myPrincipal.IsInRole(role);

rc = HttpContext.Current.User.IsInRole(role);

But rc is always false. My HttpContext.Current.User.Identity.Name is
returning Administrator as it should, but it doesn't recognize any groups
that i put administrator into.

Any ideas?

-Randy
 
J

Joe Kaplan \(MVP - ADSI\)

Sometimes group changes require a reboot to update the logon token. Have
you tried that?

Another thing to try would be the sample Hernan posted a day or two ago that
shows how to use reflection to get the list of groups the user is in from
the private function in the WindowsIdentity class. This is often useful for
debugging this situation although you don't want to use it in production
code.

Joe K.
 

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top