NegotiateStream.ImpersonationLevel Egenskap

Definition

Hämtar ett värde som anger hur servern kan använda klientens autentiseringsuppgifter.

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

Egenskapsvärde

Ett av TokenImpersonationLevel värdena.

Undantag

Autentiseringen misslyckades eller har inte inträffat.

Exempel

I följande kodexempel visas värdet för den här egenskapen.

 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);
}

Kommentarer

Du måste autentisera innan du anropar den här metoden. Klienter anger personifieringsnivån när de begär autentisering genom att anropa någon av AuthenticateAsClient metoderna eller BeginAuthenticateAsClient . Om du autentiserar utan att ange en TokenImpersonationLevel används Identification .

Gäller för