HttpCookie.Path Property


Gets or sets the virtual path to transmit with the current cookie.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

public string Path { get; set; }

Property Value

Type: System.String

The virtual path to transmit with the cookie. The default is /, which is the server root.

The Path property extends the Domain property to completely describe the specific URL to which the cookie applies. For example, in the URL http:/, the domain is and the path is /asp.

The following code example sets the Path property of a new cookie.

MyCookie.Path = "/asp";

.NET Framework
Available since 1.1
Return to top