我正在使用下面的代码来获取用户组,但我不知道如何编写代码来说明如果用户在“TestGroup”中做了一些事情,如果没有重定向页面?
Dim resEnt As SearchResult
Try
For Each resEnt In mySearcher.FindAll()
LabelUser.Text = resEnt.GetDirectoryEntry.Properties.Item("DisplayName").Value
LabelLocation.Text = resEnt.GetDirectoryEntry.Properties.Item("SystemUserLocation").Value
LabelState.Text = resEnt.GetDirectoryEntry.Properties.Item("st").Value
LabelCountry.Text = resEnt.GetDirectoryEntry.Properties.Item("c").Value
Dim result As SearchResult = mySearcher.FindOne()
If (result Is Nothing) Then
Else
Dim groupColl As Object
For Each groupColl In resEnt.Properties("memberof")
Dim GroupArray As Array = groupColl.split(",")
Select Case GroupArray(0).replace("CN=", "")
Case "TestGroup"
'Continue loading page
Case Else
'Prevent page from loading????
End Select
Next groupColl
End If
Next
Catch f As Exception
Console.WriteLine(f.ToString)
End Try