开发者

C# Validate an Administrator from Login information

开发者 https://www.devze.com 2023-01-08 19:53 出处:网络
I\'m having a bit of a problem with an application I am writin开发者_如何学运维g in C#. I can\'t seem to find a way to check if a user is an administrator just from their username and password. I have

I'm having a bit of a problem with an application I am writin开发者_如何学运维g in C#. I can't seem to find a way to check if a user is an administrator just from their username and password. I haven't seen anything helpful for doing this elsewhere and all tries to attempting such with WindowsIdentity end up helpless. I am aware of UAC programming with Windows Vista and Windows 7, however I plan on supporting Windows XP; thus rendering the possibility of using administrator access via UAC unlikely. I am only looking for a way of creating a method that takes the string Username and string Password and returns the boolean of if the credentials refer to an administrator account.

Is there any feasible way of doing this?

Thanks.


Here's an SO question that might help you out.

Also, the MSDN entry for WindowsImpersonationContext has a good example.

0

精彩评论

暂无评论...
验证码 换一张
取 消