Udostępnij przez


NegotiateStream.ImpersonationLevel Właściwość

Definicja

Pobiera wartość wskazującą, jak serwer może używać poświadczeń klienta.

public:
 virtual property System::Security::Principal::TokenImpersonationLevel ImpersonationLevel { System::Security::Principal::TokenImpersonationLevel get(); };
public virtual System.Security.Principal.TokenImpersonationLevel ImpersonationLevel { get; }
member this.ImpersonationLevel : System.Security.Principal.TokenImpersonationLevel
Public Overridable ReadOnly Property ImpersonationLevel As TokenImpersonationLevel

Wartość właściwości

TokenImpersonationLevel Jedna z wartości.

Wyjątki

Uwierzytelnianie nie powiodło się lub nie wystąpiło.

Przykłady

Poniższy przykład kodu przedstawia wyświetlanie wartości tej właściwości.

 static void DisplayAuthenticationProperties(NegotiateStream stream)
{
     Console.WriteLine("IsAuthenticated: {0}", stream.IsAuthenticated);
    Console.WriteLine("IsMutuallyAuthenticated: {0}", stream.IsMutuallyAuthenticated);
    Console.WriteLine("IsEncrypted: {0}", stream.IsEncrypted);
    Console.WriteLine("IsSigned: {0}", stream.IsSigned);
    Console.WriteLine("ImpersonationLevel: {0}", stream.ImpersonationLevel);
    Console.WriteLine("IsServer: {0}", stream.IsServer);
}

Uwagi

Należy pomyślnie uwierzytelnić się przed wywołaniem tej metody. Klienci określają poziom personifikacji, gdy żądają uwierzytelniania, wywołując jedną z AuthenticateAsClient metod lub BeginAuthenticateAsClient . Jeśli uwierzytelniasz się bez określania elementu , Identification zostanie użyta TokenImpersonationLevel wartość .

Dotyczy