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 Technical Topic Term project update Microsoft Visual Studio.NET Roadshow Job search tip: effective networking – 2978,00.asp (eWeek Labs: Break Out of Your Shell, 10/28/02 issue) 2978,00.asp Upcoming quizzes –11/12: chapters 9, 10, 11 –11/19: chapters 12, 13, 14 –No quiz tonight
Administrative – Technical Topic Comments on the requirements –One page summary (HTML format) for web posting Must include bibliography of your research sources Reference to a recent, relevant news article (industry trade article, NY Times, Wall Street Journal; not SJ Mercury) –Business focus: why should your employer care/be concerned about this?
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
DHTML Utilizes the objects, methods and properties of the web page (known as the document) Lets to you alter the web page when it’s being served up and respond to events Example code: –color-survey-array.htm –National Parks slide show –bEssentials order 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