WindowsAuthenticationEventArgs.Identity Eigenschap

Definitie

Hiermee wordt de Windows-identiteit doorgegeven aan de WindowsAuthenticationEventArgs constructor.

public:
 property System::Security::Principal::WindowsIdentity ^ Identity { System::Security::Principal::WindowsIdentity ^ get(); };
public System.Security.Principal.WindowsIdentity Identity { get; }
member this.Identity : System.Security.Principal.WindowsIdentity
Public ReadOnly Property Identity As WindowsIdentity

Waarde van eigenschap

De Windows identiteit die is doorgegeven aan de WindowsAuthenticationEventArgs constructor.

Voorbeelden

In het volgende codevoorbeeld wordt de gebeurtenis WindowsAuthentication_OnAuthenticate gebruikt om de User eigenschap van de huidige HttpContext in te stellen op een aangepast IPrincipal object.

public void WindowsAuthentication_OnAuthenticate(object sender, WindowsAuthenticationEventArgs args)
{
  if (!args.Identity.IsAnonymous)
  {
    args.User = new Samples.AspNet.Security.MyPrincipal(args.Identity);
  }
}
Public Sub WindowsAuthentication_OnAuthenticate(sender As Object, args As WindowsAuthenticationEventArgs)
  If Not args.Identity.IsAnonymous Then
    args.User = New Samples.AspNet.Security.MyPrincipal(args.Identity)
  End If
End Sub

Opmerkingen

De WindowsAuthenticationModule maakt een WindowsAuthenticationEventArgs-object met behulp van de Windows identiteit die is geleverd door IIS en de huidige HttpContext en geeft dit door aan de gebeurtenis WindowsAuthentication_OnAuthenticate.

Als IIS anonieme verificatie gebruikt, wordt de Identity eigenschap ingesteld op de identiteit die door de GetAnonymous methode wordt geretourneerd.

Van toepassing op

Zie ook