FormsAuthenticationConfiguration.Path Property

Definition

Gets or sets the cookie path.

C#
[System.Configuration.ConfigurationProperty("path", DefaultValue="/")]
[System.Configuration.StringValidator(MinLength=1)]
public string Path { get; set; }

Property Value

The path of the HTTP cookie to use for authentication. The default value is a slash (/), which represents the Web-application root.

Attributes

Examples

The following code example shows how to access the Path property. Refer to the code example in the FormsAuthenticationConfiguration class topic to learn how to get the section.

C#
// Get the current Path.
string currentPath = formsAuthentication.Path;
// Set the Path property.
formsAuthentication.Path = "newPath";

Remarks

The Path property indicates where the authentication cookie resides and is transmitted along with the authentication cookie itself.

Applies to

Производ Верзије
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also