HttpCookie.Domain 屬性

定義

取得或設定網域來關聯 cookie。

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

屬性值

要關聯 Cookie 的網域名稱。 預設值為當前網域。

範例

以下程式碼範例設定了 Cookie 的網域。

MyCookie.Domain = "Microsoft.com";

MyCookie.Domain = "Microsoft.com"
    

備註

設定 屬性 Domain 會限制 Cookie 傳送給請求該網域資源的客戶端。

適用於