ASP.NET Tutorial/Authentication Authorization/WindowsIdentity

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Using the WindowsIdentity object

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Security.Principal" %>
    
<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, _
      ByVal e As System.EventArgs)
    
       Dim AuthUser As WindowsIdentity = WindowsIdentity.GetCurrent()
       Response.Write(AuthUser.AuthenticationType.ToString() & "<br>" & _
          AuthUser.ImpersonationLevel.ToString() & "<br>" & _
          AuthUser.IsAnonymous.ToString() & "<br>" & _
          AuthUser.IsAuthenticated.ToString() & "<br>" & _
          AuthUser.IsGuest.ToString() & "<br>" & _
          AuthUser.IsSystem.ToString() & "<br>" & _
          AuthUser.Name.ToString())
    End Sub
</script>