Share via


FormsAuthenticationConfiguration.Path 屬性

定義

取得或設定 Cookie 路徑。

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

屬性值

String

要用於驗證之 HTTP Cookie 的路徑。 預設值是正斜線 (/),表示 Web 應用程式的根目錄。

屬性

範例

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

// Get the current Path.
string currentPath = formsAuthentication.Path;
// Set the Path property.
formsAuthentication.Path = "newPath";
' Get the current Path.
Dim currentPath As String = formsAuthentication.Path
' Set the Path property.
formsAuthentication.Path = "newPath"

備註

屬性 Path 會指出驗證 Cookie 所在的位置,並連同驗證 Cookie 本身一起傳輸。

適用於

另請參閱