getKeys

The getKeys method of the Cookie class returns an enumerator for a Cookie object, which you can use to access key values.

public wfc.util.IEnumerator getKeys();

Example

The following Boolean function returns true if the cookie contains values, and false if it does not.

public Boolean checkgetkeys()
{
Request myRequest = AspContext.getRequest();
CookieDictionary myCookies = myRequest.getCookies();
Cookie myCookie = myCookies.getCookie("cookiedata");
Enumerator keylist = (myCookie.getKeys ());
  if (keylist.hasMoreElements())   
   {
    //The cookie has key values 
    return true
   }
   else 
    {
   //it doesn't
   return false
    }
}

© 1999 Microsoft Corporation. All rights reserved. Terms of use.