41cgistate-2up - 41 CGI State 21 Oct, 2010 CSCC09F...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
41 CGI State 21 Oct, 2010 CSCC09 Programming on the Web 1 41 CGI State CSCC09 Programming on the Web 1 CSCC09F Programming on the Web CGI Session State coping with HTTP’s stateless behavior: CGI session state handling mechanisms 41 CGI State CSCC09 Programming on the Web 3 Statelessness b Recall from earlier coverage of HTTP that this client-server protocol is stateless. c this is good for keeping the server simple c but is a bit of a problem for implementing transaction type services over the Web, where a user performs a sequence of interactions that constitute a single “session” b e.g. online shopping, banking, library request, concert ticket order, flight reservation c how can server-side CGI code tell which requests are from a user who already has an active session in progress – e.g. a partially filled shopping cart?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
41 CGI State 21 Oct, 2010 CSCC09 Programming on the Web 2 41 CGI State CSCC09 Programming on the Web 4 Statelessness b We’re going to look at each of the options in common use for tracking state, roughly in order of increasing popularity and utility b Pay particular attention to the limitations and drawbacks associated with the different approaches c some approaches not suitable for certain kinds of applications (e.g. privacy concern) c it may be necessary to use a combination of approaches for some applications 41 CGI State CSCC09 Programming on the Web 5 Statefulness b What can we do with session state info? All kinds of magical (and useful) things: c “shopping cart” – keep track of selections made across multiple client requests – applicable to many areas of e- commerce c identification of users and sessions – e.g. for authenticated access to secure site c track user movement through web site (where have the been, what have they seen) c customize views of web site using user preferences or previous behavior (“I only browse items that are on sale”).
Background image of page 2
41 CGI State 21 Oct, 2010 CSCC09 Programming on the Web 3 41 CGI State CSCC09 Programming on the Web 6 Tracking State: URL Rewriting b Store state in page URL’s: rewrite embedded URLs for your site so that they include state variables b Each URL, in pages that are part of your site, transformed into a CGI-get request b Requires all URL’s contain all state information (leading to possibly long URLs) b Current submitted CGI request represents server’s view of current state 41 CGI State CSCC09 Programming on the Web 7 URL Rewriting every URL on returned page has …?var1=val1&var2=val2&…, added, for all state var’s time Client page request based on embedded URL reference Client page request every URL on returned page has …?var1=val1&var2=val2&…, added, for all state var’s
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
41 CGI State 21 Oct, 2010 CSCC09 Programming on the Web 4 41 CGI State CSCC09 Programming on the Web 8 URL Rewriting Examples b Try out example: URLRewrite.cgi Follow the links a few times Play with the reload and back buttons Visit the site by URL alone: URLRewrite.cgi Trick the application into thinking you have
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/09/2010 for the course CS CSCC09 taught by Professor Alan during the Spring '10 term at University of Toronto.

Page1 / 14

41cgistate-2up - 41 CGI State 21 Oct, 2010 CSCC09F...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online