Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey,

Ive been google'ing and trying to figure this out for ages, I don't see what I've done wrong, could someone please help???

Im using the below code and I have no idea why it is returning false...

C#
public bool checkIn(string group)
{
    System.Security.Principal.WindowsPrincipal user = new WindowsPrincipal(WindowsIdentity.GetCurrent());
    return user.IsInRole(@"Bubblebee\Admin");
    //return user.IsInRole(@group);
}

The weird thing Im seeing here is it returns true if I use the group @"Bubblebee\HomeUsers" in place of the 'group' variable, but any other groups I type in.. Bubblebee\Administrators , or even groups ive created like 'Admin', all return false, Im definitely a member of these groups and they are all local to my machine, no domain is setup.

Just to be sure ive also disabled anonymous logins and enabled windows authentication, I've also added the below line to my web.config (not sure if its needed, didn't help)
XML
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider"/> 
Posted
Comments
Bernhard Hiller 26-Nov-13 5:30am    
"my web.config" - what type of program is it - aspx hosted in IIS, or a "normal" Windows applicaiton (Forms/WPF/Console)?
Gloomy88 26-Nov-13 5:33am    
it is a asp.net site using iis
Freak30 26-Nov-13 6:58am    
Have you checked which user the process runs under? If this is a web application, the chances are quite high that it is not your local windows user but something generic.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900