HttpListener.Realm HttpListener.Realm HttpListener.Realm HttpListener.Realm Property

定義

取得或設定與這個 HttpListener 物件關聯的領域 (或資源分割)。Gets or sets the realm, or resource partition, associated with this HttpListener object.

public:
 property System::String ^ Realm { System::String ^ get(); void set(System::String ^ value); };
public string Realm { get; set; }
member this.Realm : string with get, set
Public Property Realm As String

屬性值

String 值,包含與 HttpListener 物件關聯的領域名稱。A String value that contains the name of the realm associated with the HttpListener object.

例外狀況

範例

下列程式碼範例將示範如何Realm設定屬性。The following code example demonstrates setting the Realm property.

public static void ConfigureListener1(HttpListener listener)
{
    // Specify an authentication realm.
    listener.Realm = "ExampleRealm";
}
Public Shared Sub ConfigureListener1(ByVal listener As HttpListener)
    ' Specify an authentication realm.
    listener.Realm = "ExampleRealm"
End Sub

備註

伺服器會使用領域來分割受保護的資源;每個分割區都可以有自己的驗證配置和/或授權資料庫。Servers use realms to partition protected resources; each partition can have its own authentication scheme and/or authorization database. 領域只限於基本和摘要式驗證使用。Realms are used only for basic and digest authentication. 當用戶端成功驗證之後,驗證對指定領域中的所有資源都有效。After a client successfully authenticates, the authentication is valid for all resources in a given realm. 如需領域的詳細說明, 請參閱 RFC 2617 https://www.ietf.org/, 網址為。For a detailed description of realms, see RFC 2617 at https://www.ietf.org/.

實例只有一個HttpListener相關聯的領域。An instance of HttpListener has only one associated realm.

適用於