Working with Cookies - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Working with Cookies

Description:

A cookie is information that a Web site puts on your hard disk so that it can ... In IE, its in a Cookies Folder under Documents and Settings. ... – PowerPoint PPT presentation

Number of Views:143
Avg rating:3.0/5.0
Slides: 10
Provided by: patmc2
Category:
Tags: cookies | working

less

Transcript and Presenter's Notes

Title: Working with Cookies


1
Working with Cookies
2
What is a Cookie?
  • According to Whatis.com a cookie is
  • A cookie is information that a Web site puts on
    your hard disk so that it can remember something
    about you at a later time.
  • In Netscape, a cookie file is stored in the
    Cookies.txt folder in the Netscape folder.
  • In IE, its in a Cookies Folder under Documents
    and Settings.
  • Use Windows Search to find Cookies files and
    folders

3
A Cookie File From Netscape
C\Program Files\Netscape\Users\pmckeown\Cookies.t
xt
4
Cookies File in IE
C\Documents and Settings\pmckeown\Cookies
5
Creating a Guestbook Application with Cookies
  • Lets create the same Guestbook application shown
    in the Dummies pp 174-181
  • We will use a database rather than a sequential
    access file
  • Download the database file from the class Web
    page along with the default.htm, gb.htm, and
    gbproc.asp files. They are zipped so you will
    need to unzip them.

6
Guestbook Application
  • The Guestbook.zip file contains 6 files
  • Guestbook.mdb (an Access 2000 file)
  • DBConnect2000.asp (you should already have this)
  • GB.htm (the file used to add names to guestbook
    and set preferences)
  • GBProc.asp (file used to process names and
    preferences)
  • Default.asp (the file that checks if a cookie
    exists or not)
  • Global.asa (the application file that glues
    everything together)

7
Default.asp
  • Default.asp checks to see if a cookie exists and,
    if it does, set preferences using data from the
    cookie and welcomes the visitor
  • If does this by checking the value of a field in
    the cookie file.
  • Cookie values are read through the
    Request.Cookies (filename)(fieldname)
    statement
  • If a cookie does not exist, this is the first
    visit to site so it user is redirected to gb.htm
    to fill in the form there

8
GB.htm
  • This is a standard html page with an input form
    that is used to input information about user to
    Guestbook.mdb
  • It uses text boxes and listboxes to solicit
    information
  • Nothing real new

9
GBproc.asp
  • This file adds a new record to the Guestbook.mdb
    file using the Insert Into SQL Statement
  • It also sets preferences in cookie based on those
    expressed by visitor.
  • Preferences are set in the cookie through the
    Response.cookies(filename)(fieldname)
    statement
  • Lets start with the GB.htm file since its the
    basis of all other information.
Write a Comment
User Comments (0)
About PowerShow.com