Docstoc

B118 Web Programming

Document Sample
B118 Web Programming Powered By Docstoc
					B118 Web Programming


    Session #9 Client/Server & Cookies
              April 5, 2004
Tonight’s Agenda

•   Administrative
•   DHTML
•   Order Form Validation Homework Assignment
•   Client/Server & Cookies
•   Intro to ASP .NET
Administrative – Term Project

• Database structure
   – Microsoft Access
   – Single table for each company (I’ll provide the
     design/template to you)
• Core modules: all are ASP.NET which I’ll provide
   – Catalog (by product)
   – Catalog (by store)
   – Catalog (by keyword)
   – Shopping cart review
• ASP.NET module you need to write: feedback form
Order Form Validation Homework
Assignment
• Due on 4/19: diskette + printout
• Enhancements
   – Data validation
   – Shipping & sales tax calculation
   – Optional: text alignment and read-only field
     protection
• Details on course website (see course
  calendar)
Order Form Data Validation
Client/Server & Cookies

• Needed to maintain state
   – Keeping track of information across web
     pages
   – JavaScript can’t share variable values
     across web pages or after the browser stops
• Somewhat controversial because of privacy
  issue concerns
• Used to serve as the basis for the shopping
  cart mechanism for the bEssentials project
Cookies - Overview

• Small file stored on user’s hard drive (location
  depends on the browser)
• Any web page can create a cookie
• Can be read only by another web page from
  the same Internet domain (or by the local
  user)
• Maximum # of characters = 2-4K
• Other limits on total # of characters per
  domain & total # of cookies
Cookies – Technical Details

• Access through the document object, cookie
  property (or document.cookie)
  – A string value containing five parts:
     1. Cookie name & value
     2. Cookie’s expiration date
     3. Pathname of web page that created the cookie
     4. Domain name of the server that created the
        cookie
     5. Optional security parameter
  – Browser usually fills in the last three items
Cookies – Sample JavaScript Code

• Key code
   – document.cookie = {string value} + …
     + {string value}
   – document.cookie.split(“field_
     deliminator”)[cookie_part]
• make-cookie.htm and read-cookie.htm
Intro to ASP .NET

• JavaScript can’t hide the source code from the
  user
• ASP (Active Server Pages) and ASP .NET
  generates HTML code on the server using
  VBScript or JavaScript/JScript. All the user
  sees is the final HTML product
• first.aspx, first(js).aspx, ForCounter.aspx
  – All on http://cypress.cob.sjsu.edu/b118w/wong_ronald

				
DOCUMENT INFO