html5-img
1 / 25

Managing Web Site Data

Managing Web Site Data. CS 320. Web Site Data. How do computer programs store data? Main memory: volatile Disk: permanent By definition, Web pages are stateless and do not store data. Browser Session. Begins when the user opens the browser and connects to a site

Download Presentation

Managing Web Site Data

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Managing Web Site Data CS 320

  2. Web Site Data • How do computer programs store data? • Main memory: volatile • Disk: permanent • By definition, Web pages are stateless and do not store data

  3. Browser Session • Begins when the user opens the browser and connects to a site • Ends when the user navigates to a new page or closes the browser • All input data is lost... • What kind of data might you want to store across pages during a single visit to a Web site? • What kind of data might you want to store across multiple visits to the same Web site?

  4. Approaches for Storing Web Page Data • Between Web pages in the same visit: • Session variables • Temporary cookies • Across multiple visits to a site: • Persistent cookies • Databases

  5. Specific Topics • Session variables • Cookies • Databases

  6. Session Variables • When you request a Web page, the Web server creates a session object corresponding to your browser session • This information is stored in the Web server's main memory • Sessions have attributes that you can retrieve and display using program commands

  7. Session Variables • A program running on the Web server can create session variablesthat store data values associated with a specific browser session • Values are stored in Web server RAM and associated with the session object

  8. Session Timeout Intervals • By default, server/browser sessions "time out" (close) after a specific period of inactivity: • Microsoft IIS: 20 minutes • Tomcat: 30 minutes • You can change these values to longer/shorter ones • At that point, the session closes and the session object is destroyed • All session variable data is lost!

  9. Limitations of Session Variables • Usually have a limited size • Often limited to a maximum size of 300 characters • Values are lost when the session ends or times out

  10. Specific Topics • Session variables • Cookies • Databases

  11. What is a Cookie? • Data item stored on the client workstation • Can (theoretically) be read/modified only by Web pages associated with the same Web server domain that originally created it • Cookie types: • Temporary (session): only lasts during the current session • Stored in client (browser) RAM • Can be read only in current browser session • Persistent: stores data in the client file system that is available across multiple browser sessions

  12. Cookie Data Structure • Name/value pairs: cookie_name=cookie_value • Example: currUsername="morrisjp"

  13. Cookie Options • Client-side • Created using JavaScript • Server-side • Created using a server-side program

  14. Limitations of Cookies • Typically, browsers have limits on persistent cookies: • Maximum of 20 cookies per Web site • Maximum of 300 cookies total • Each cookie can store a maximum of 4 KB of data...

  15. More Limitations of Cookies • Stored locally • If you use multiple computers, you will have different sets of cookies • Possibility of: • Information theft • Cookie poisoning • Other Web sites change cookie contents • Profiling • Marketers create cookies that are shared among sites • Users can disable cookies in their browser

  16. Specific Topics • Session variables • Cookies • Databases

  17. What is a database? • Program for storing data • Structures data in a tabular format • Maintains relationships among data items • Example: customers make reservations • Has built-in programs to perform the basic data handling tasks • Insert, update, delete, retrieve • Has built-in features for managing multiple users, security, backups, etc.

  18. Web/Database Architecture Client workstations Web server(s) Database server Browser Data Base Browser Server-Side Programs Network Network Browser Commonly-used: • mySQL • Access • SQL Server • Oracle Programs that: • Form queries based on user inputs • Display retrieved data • Insert/update/delete user data

  19. When does a Web site need a database? • When the site needs to collect and store data from site users • Usernames/passwords for site access • Product selection and shipping information • User inputs that need to be visible to other users

  20. Test Yourself:For an Ecommerce Web site, what would you use to store a user's shipping information (name, address)? • Session variables • Temporary cookie • Persistent cookie • Database • None of the above

  21. Test Yourself:For an Ecommerce Web site, what would you use to store a user's shipping information (name, address)? • Session variables • Temporary cookie • Persistent cookie • Database • None of the above

  22. Test Yourself:For an Ecommerce Web site, what would you use to store a user's shopping cart contents? • Session variables • Temporary cookie • Persistent cookie • Database • None of the above

  23. Test Yourself:For an Ecommerce Web site, what would you use to store a user's shopping cart contents? • Session variables • Temporary cookie • Persistent cookie • Database • None of the above

  24. Test Yourself:For an Ecommerce Web site, what would you use to store a user's credit card information? • Session variables • Temporary cookie • Persistent cookie • Database • None of the above

  25. Test Yourself:For an Ecommerce Web site, what would you use to store a user's credit card information? • Session variables • Temporary cookie • Persistent cookie • Database • None of the above

More Related