







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of cookies in asp, including how to read and write dictionary cookies, cookie concepts, detecting cookie acceptance, when cookies go bad, uses of cookies, client-side cookies, and cookie management and gotchas. It also discusses the benefits and concerns of using cookies.
Typology: Slides
1 / 13
This page cannot be seen from the preview
Don't miss anything!








Determining a dictionary cookie
(Returns true/false)
CkDict = Request.Cookies("MyCookie").HasKeys •^
Determine the dictionary Cookie keys count with Mycount = Request.Cookies("MyCookie").Count •^
Read dictionary cookie values by subkey or index. Myval
= Request.Cookies("MyCookie")("1stval")
Myval
= Request.Cookies("MyCookie")(1)
Read all values in a dictionary cookie by iteratingthrough the subkeys. For Each key
in Request.Cookies("MyCookie")
Response.Write key & "-" & _Request.Cookies("MyCookie")(key) Next •^
Reading a non-existent key from a dictionary cookiereturns null. Use .HasKeys to avoid errors.
Cookies persist
only
as long as the client's
browser is open
unless
an expiration date is
explicitly added to the cookie.
-^
Cookies are only available to thedomain/webserver that created them.
-^
Cookies will be sent to any subdomain within thelast two segments of the domain name, e.g., acookie for www.microsoft.com is also available tohome.microsoft.com and msdn.microsoft.com.
Cookies should not exceed 255 characters and 4KB insize, and best practice is to make them as small aspossible.
-^
For Netscape browsers, a specific domain can onlyset a maximum of 20 cookies on the client.
-^
Do not write information cookies that could becompromising to the client, e.g., credit cardnumbers, etc.
-^
Domain and Path properties can be very sensitive tocase. Best to avoid using when possible.
Cookie expires.
-^
User replaces hard drive or computer.
-^
Client deletes cookies.
-^
Client’s browser deletes cookie because has morethan 300 cookies.
-^
Client configures browser to not accept cookies.
-^
Client’s LAN/firewall prevents setting or readingof cookies.
Client uses different browser software.
-^
Client uses a different computer.
-^
A different user uses the client’s browser.
-^
Cookie file becomes corrupted/damaged.
JavaScript supplies a built-in object calleddocument.cookie to handle cookie interaction. Thisobject will store all the valid cookies for the givenpage the script is running on.
Many people unnerved by webservers writinganything to their machines.
-^
Bigger concerns about tracking the client's activitiesin a site – this can is good or bad depending uponhow it is used.
-^
There have been some bugs in cookieimplementations, e.g., email address was available inone version of Netscape.
In ASP pages, must write cookie before the HTMLelement or enable buffering.
-^
In ASP pages, alleged bug in response.cookiesmethod may allow writing out value only once.
-^
Cookie will expire at end of client’s browsersession unless you set its Expires property.
-^
Always rewrite all values of a dictionary cookie.
-^
Your pages may need to deal with browsers thatdon't support cookies.
-^
The Domain and Path properties are VERY casesensitive.