HttpCookieCollection.Item Property (String)

 

Gets the cookie with the specified name from the cookie collection.

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

public HttpCookie this[
	string name
] { get; }

Parameters

name
Type: System.String

Name of cookie to retrieve.

Property Value

Type: System.Web.HttpCookie

The HttpCookie specified by name.

The following example gets the cookie with the name "LastVisit" and extracts its value.

String str;
 str = Request.Cookies["LastVisit"].Value;

.NET Framework
Available since 1.1
Return to top
Show: