FormsAuthenticationConfiguration.Domain 属性

定义

获取或设置要与 Forms 身份验证 Cookie 一同发送的域名。Gets or sets the domain name to be sent with forms authentication cookies.

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

属性值

String

用于输出 Forms 身份验证 Cookie 的域的名称。The name of the domain for the outgoing forms authentication cookies. 默认值为空字符串。Default is an empty string.

属性

示例

下面的代码示例演示如何访问 Domain 属性。The following code example shows how to access the Domain property. 请参阅类主题中的代码示例 FormsAuthenticationConfiguration ,了解如何获取部分。Refer to the code example in the FormsAuthenticationConfiguration class topic to learn how to get the section.

// 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。The Domain is used for the authentication cookies.

此属性对应于的值 HttpCookie.DomainThis property corresponds to the value of HttpCookie.Domain.

domain对于窗体身份验证 cookie,此设置将优先于节的属性。This setting will take precedence over the domain attribute of the section for forms authentication cookies.

适用于