以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- ad认证怎么做 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=193999) |
-- 作者:lur320 -- 发布时间:2024/11/1 10:02:00 -- ad认证怎么做 公司有AD服务器,狐表怎么获取本机的AD认证? |
-- 作者:有点蓝 -- 发布时间:2024/11/1 10:22:00 -- 添加引用:System.DirectoryServices.AccountManagement.dll :http://www.foxtable.com/webhelp/topics/1936.htm Try Dim context As New System.DirectoryServices.AccountManagement.PrincipalContext(System.DirectoryServices.AccountManagement.ContextType.Domain) Dim user As System.DirectoryServices.AccountManagement.UserPrincipal = System.DirectoryServices.AccountManagement.UserPrincipal.Current If user IsNot Nothing Then Dim isAuthenticated As Boolean = context.ValidateCredentials(user.SamAccountName, "用户密码") If isAuthenticated Then msgbox("用户通过AD认证。") Else msgbox("用户没有通过AD认证。") End If Else msgbox("无法获取当前用户。") End If Catch ex As Exception msgbox("发生错误: " & ex.Message) End Try [此贴子已经被作者于2024/11/1 10:23:00编辑过]
|
-- 作者:lur320 -- 发布时间:2024/11/1 10:43:00 -- 谢谢。可以用。 |