Share via


FormsAuthenticationConfiguration.Domain 屬性

定義

取得或設定要以表單驗證 Cookie 傳送的網域名稱。

public:
 property System::String ^ Domain { System::String ^ get(); void set(System::String ^ value); };
[System.Configuration.ConfigurationProperty("domain", DefaultValue="")]
public string Domain { get; set; }
[<System.Configuration.ConfigurationProperty("domain", DefaultValue="")>]
member this.Domain : string with get, set
Public Property Domain As String

屬性值

外送表單驗證 Cookie 的網域名稱。 預設值為空字串。

屬性

範例

下列程式碼範例示範如何存取 Domain 屬性。 請參閱類別主題中的 FormsAuthenticationConfiguration 程式碼範例,以瞭解如何取得區段。

// Get the current Domain.
string currentDomain = 
    formsAuthentication.Domain;

// Set the current Domain
formsAuthentication.Domain = "newDomain";
' Get the current Domain.
Dim currentDomain As String = formsAuthentication.Domain

' Set the current Domain
formsAuthentication.Domain = "newDomain"

備註

Domain用於驗證 Cookie。

這個屬性會對應至 的值 HttpCookie.Domain

此設定會優先于 domain 表單驗證 Cookie 區 forms 段的 屬性。

適用於