SslStream.IsServer Właściwość

Definicja

Pobiera wartość wskazującą Boolean , czy lokalna strona połączenia użytego przez to SslStream zostało uwierzytelnione jako serwer.

public:
 virtual property bool IsServer { bool get(); };
public override bool IsServer { get; }
member this.IsServer : bool
Public Overrides ReadOnly Property IsServer As Boolean

Wartość właściwości

true jeśli lokalny punkt końcowy został pomyślnie uwierzytelniony jako strona serwera uwierzytelnionego połączenia; w przeciwnym razie false.

Przykłady

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

static void DisplaySecurityServices( SslStream^ stream )
{
   Console::WriteLine( L"Is authenticated: {0} as server? {1}", stream->IsAuthenticated, stream->IsServer );
   Console::WriteLine( L"IsSigned: {0}", stream->IsSigned );
   Console::WriteLine( L"Is Encrypted: {0}", stream->IsEncrypted );
   Console::WriteLine( L"Is mutually authenticated: {0}", stream->IsMutuallyAuthenticated );
}
static void DisplaySecurityServices(SslStream stream)
{
   Console.WriteLine("Is authenticated: {0} as server? {1}", stream.IsAuthenticated, stream.IsServer);
   Console.WriteLine("IsSigned: {0}", stream.IsSigned);
   Console.WriteLine("Is Encrypted: {0}", stream.IsEncrypted);
   Console.WriteLine("Is mutually authenticated: {0}", stream.IsMutuallyAuthenticated);
}
Private Shared Sub DisplaySecurityServices(stream As SslStream)
    Console.WriteLine("Is authenticated: {0} as server? {1}", stream.IsAuthenticated, stream.IsServer)
    Console.WriteLine("IsSigned: {0}", stream.IsSigned)
    Console.WriteLine("Is Encrypted: {0}", stream.IsEncrypted)
    Console.WriteLine("Is mutually authenticated: {0}", stream.IsMutuallyAuthenticated)
End Sub

Uwagi

Jeśli uwierzytelnianie nie powiodło się lub nie wystąpiło, ta właściwość zwraca wartość false.

Aby uwierzytelnić się jako serwer, wywołaj AuthenticateAsServer metody or BeginAuthenticateAsServer .

Dotyczy