getHasKeys

The getHasKeys method of the Cookie class returns a Boolean variable that indicates whether the Cookie class includes key values.

public boolean getHasKeys();

Example

The following example defines a function that returns true if a cookie called cookiedata contains key values.

// testgetkeys
import aspcomp.*;
public class testgetkeys 
{
  public boolean checkcookies()
  {
  Request myRequest = AspContext.getRequest();
  CookieDictionary myCookies = myRequest.getCookies();
  Cookie myCookie = myCookies.getCookie("cookiedata");
   if (myCookie.getHasKeys())
         {
         //The cookie has key values 
   return true
    }
    else 
    {
   //it doesn't
   return false
    }
  }
}

See Also

getKeys

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