在C#3.0的Windows本地用户帐户的身份验证 [英] Authentication of Windows Local User account in C# 3.0

查看:290
本文介绍了在C#3.0的Windows本地用户帐户的身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何验证本地Windows用户帐户C#3.0。 Windows操作系统上我要验证密码是Vista和Win2K8。
注:用户帐户是本地帐户,而不是一个域帐户。
我发现在C#3.5(PrincipalContext类)的解决方案,但在3.0框架找不到。
请建议,谢谢

How to authenticate local windows user account in C# 3.0. Windows OS on which i have to validate the password is Vista and Win2K8. Note: User account is a local account and not an domain account. I found a solution in C# 3.5(PrincipalContext class), but could not find in 3.0 framework. Please suggest, thanks

推荐答案

如果您正在寻找验证本地用户,您可以使用LogonUser的做到这一点。它可以验证本地和远程用户。对于本地用户只是为了域通过机器名。

If you are looking to validate local users, you can use LogonUser to do this. It can validate both local and remote users. For local users simply pass the machine name in place of the domain.

下面的博客文章进入有关如何从C#调用这个函数的细节。

The following blog entry goes into detail about how to call this function from C#.

<击> [http://alt.pluralsight.com/wiki/default.aspx/Keith.GuideBook/HowToGetATokenForAUser.html]

[http://alt.pluralsight.com/wiki/default.aspx/Keith.GuideBook/HowToGetATokenForAUser.html]

<一个href=\"https://web.archive.org/web/20110224015020/http://alt.pluralsight.com/wiki/default.aspx/Keith.GuideBook/HowToGetATokenForAUser.html\" rel=\"nofollow\">https://web.archive.org/web/20110224015020/http://alt.pluralsight.com/wiki/default.aspx/Keith.GuideBook/HowToGetATokenForAUser.html

修改

这是验证用户的最佳方式。一旦你用会话完成后,你应该叫 CloseHandle的的在所得令牌。

This is the best way to authenticate a user. Once you're done with the session, you should call CloseHandle on the resulting token.

这篇关于在C#3.0的Windows本地用户帐户的身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆