NegotiateStream.IsServer 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會得到 Boolean 一個值,表示該 NegotiateStream 連線的本地端是否被認證為伺服器。
public:
virtual property bool IsServer { bool get(); };
public override bool IsServer { get; }
member this.IsServer : bool
Public Overrides ReadOnly Property IsServer As Boolean
屬性值
true若本地端點成功作為已認證連線的伺服器端;否則,。 false
範例
以下程式碼範例展示了此屬性的值。
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);
}
備註
若認證失敗或未發生,則此屬性會回傳 false。
要以伺服器身份認證,呼叫 or AuthenticateAsServerBeginAuthenticateAsServer 方法。