次のコードを使用して、ユーザーが特定のグループに属しているかどうかを判断しています。コードはローカルの開発環境では問題なく動作しますが、開発サーバーにプッシュすると、常に false が返されます。
IIS で構成する必要があるものはありますか?
注: このコードは特定のページでのみ実行されています。すべての Web ページでグローバルに使用されるわけではありません。
Public Function IsInGroup(ByVal GroupName As String)
Dim MyIdentity As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent()
Dim MyPrincipal As System.Security.Principal.WindowsPrincipal = New System.Security.Principal.WindowsPrincipal(MyIdentity)
'' Web team needs access to all pages. See web.config for value.
If MyPrincipal.IsInRole(ConfigurationManager.AppSettings("ISSupportAllAccessADGRoup").ToString.ToUpper) Then
Return True
Else
If MyPrincipal.IsInRole(GroupName) Then
Return True
Else
Return False
End If
End If
End Function