CookieName Property  
 

Return the name of the specified cookie.

Syntax

object.CookieName( Index )

Remarks

The CookieName property array returns a string which identifies the cookie specified by the Index argument. The array is zero based, which means the name of the first available cookie is read by using an index value of zero. The CookieCount property indicates the total number of cookies that have been returned by the server.

Data Type

String

Example

' Save the cookies set by a previous request to this server for
' a resource so that they can be sent back with the next request
nCookies = HttpClient1.CookieCount
ReDim strCookieName(nCookies)
ReDim strCookieValue(nCookies)

' Enumerate the available cookies and store them in the array;
' a more complex implementation could use the GetCookie method
' to check for additional information about the cookie, such
' as whether the cookie should be stored locally on the system
For nIndex = 0 To nCookies - 1
  strCookieName(nIndex) = HttpClient1.CookieName(nIndex)
  strCookieValue(nIndex) = HttpClient1.CookieValue(nIndex)
Next

' Clear any previously set headers
HttpClient1.ClearHeaders

' Set each of the cookies that were stored in the array
For nIndex = 0 To nCookies - 1
  HttpClient1.SetCookie strCookieName(nIndex), strCookieValue(nIndex)
Next

' Request the next resource from the server and store
' the data in the strResult string buffer
nError = HttpClient1.GetData(strResource, strResult)

See Also

CookieCount Property, CookieValue Property, GetCookie Method, SetCookie Method