









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










-^ Cookies are small pieces of information stored bythe webserver on the client’s machine. •^ Cookie information is saved in small files createdand saved by the client’s browser. •^ Cookie information is sent back to the webserverthat generated the cookie. •^ Originally developed by Netscape. Now definedby RFC 2109 (“
HTTP State Management Mechanism
-^ Developed as a mechanism to maintain statebetween client requests.
by the webserver
using a one-
line HTTP response header. Set-Cookie: NAME=VALUE;
expires=DATE; domain=DOMAIN_NAME;
path=PATH; secure e.g., Set-Cookie: UserID=234;
domain=valtara.com; path=/;
expires=Monday, 10-Nov-1999 23:59:59Set-Cookie: TestVal=test; domain=valtara.com; path=/test/;expires=Monday, 10-Nov-1999 23:59:
-^ Cookie management systems are browser-specific. •^ Programming languages like ASP abstract cookiewriting/retrieval so you don’t need to know how theclient is managing their cookies.
-^ Expires
: Number of days to persist cookie. Typically use
date+x
days or set to a specific
date with
-^ Domain
: Domain cookie originated from. Only used when you only want cookies sent to aspecific subdomain (e.g., sub1.mydomain.com vs.sub2.mydomain.com). • Path
: Virtual path cookie originated from. Only used when only want cookies sent for pages in aspecific path (e.g., /mypath). Path must matchcase of your webserver.
-^ HasKeys:
If cookie is a dictionary cookie, returns TRUE. Otherwise, returns FALSE. • Count:
Count of values in a dictionary cookie.
-^ Secure
: When present, instructs browser to send cookie encrypted to the
Path
only using HTTPS.
Rarely used since you normally want to avoidsensitive information in your cookies.
-^ Writing a single cookie: Response.Cookies("MyCookie") = MyValueResponse.Cookies("DicCookie")("Val1") = "Value1" Setting the Cookie Expiration Response.Cookies("MyCookie").Expires = date + 1Response.Cookies("MyCookie").Expires = #1/1/2000# •^ Setting other cookie attributes: Response.Cookies("MyCookie").Domain = "valtara.com"Response.Cookies("MyCookie").Path = "/test" Response.Cookies("MyCookie").Secure = True