使用VB.Net和.Net 2.0,如何查询AD以检查用户是否存在?

时间:2018-04-19 17:38:10

标签: .net vb.net active-directory

我找到了这个代码,但它适用于.Net 3.5 +

' set up domain context    
Dim ctx As New PrincipalContext(ContextType.Domain)

' find a user
Dim user As UserPrincipal = UserPrincipal.FindByIdentity(ctx, "SomeUserName")

If user IsNot Nothing Then
   ' user exists - do something here....               
Else
   ' user does not exist - do something else....
End If

有没有可以在.Net 2.0中使用的替代方案?

0 个答案:

没有答案
相关问题