c# - WCF impersonation is not impersonating an administrator -
i trying use wcf remote user management things. , reusing code had on server 2003 box , worked fine, on windows 7 test box when check see if user called function administrator says not.
[operationbehavior(impersonation=impersonationoption.required)] public string setpassword(string username) { windowsprincipal principal = new windowsprincipal(operationcontext.current.servicesecuritycontext.windowsidentity); system.diagnostics.debug.print(windowsidentity.getcurrent().name); system.diagnostics.debug.print(principal.identity.name); if (principal.isinrole(windowsbuiltinrole.administrator)) { //try { lock (watchdog.m_principalcontext) { using (userprincipal = userprincipal.findbyidentity(watchdog.m_principalcontext, username)) { string newpassword = createrandompassword(); up.setpassword(newpassword); up.save(); return newpassword; } } } //catch { return null; } } else throw new system.security.securityexception("user not administrator"); }
principal.isinrole(windowsbuiltinrole.administrator)
returning false every time. both current identity , principal.idenity correct user impersonated. , user member of administrators user group.
i think has uac implemented in windows vista , up. issue because production machine going on win2k8-r2 box.
any suggestions on do?
take @ article, under section, "coping windows vista" , written article uac , checking admin privs programatically.
Comments
Post a Comment