HttpCookieCollection.GetKey Method (Int32)
.NET Framework (current version)
Returns the key (name) of the cookie at the specified numerical index.
Assembly: System.Web (in System.Web.dll)
Parameters
- index
-
Type:
System.Int32
The index of the key to retrieve from the collection.
The following example returns each cookie from the cookie collection, checks whether it is named "LastVisit", and, if "LastVisit" is found, updates its value to the current date and time.
Dim loop1 As Integer Dim MyCookie As HttpCookie Dim MyCookieCollection As HttpCookieCollection = Request.Cookies For loop1 = 0 To MyCookieCollection.Count - 1 If MyCookieCollection.GetKey(loop1) = "LastVisit" Then MyCookieCollection(loop1).Value = DateTime.Now().ToString() MyCookieCollection.Set(MyCookieCollection(loop1)) Exit For End If Next loop1
.NET Framework
Available since 1.1
Available since 1.1
Show: