Web Cookies


Published on

Published in: Self Improvement, Technology
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Web Cookies

  1. 1. Care for some Cookies? www.apwebco.com
  2. 2. Web Cookies (A.K.A.: Browser Cookies, HTTP cookies) <ul><li>Why do we need cookies? </li></ul><ul><li>What is a cookie? </li></ul><ul><li>How does a cookie look like? </li></ul><ul><li>How does it work? </li></ul><ul><li>Cookies, e-commerce and e-banking </li></ul><ul><li>How do we control cookies? </li></ul>www.apwebco.com
  3. 3. Why Do We Need Cookies? WEB SERVER Ana John Peter browser browser browser HTTP HTTP (Hypertext Transfer Protocol) HTTP www.apwebco.com <ul><li>Internet Browser and Web Server communicate trough HTTP protocol which is stateless </li></ul><ul><li>Often we need to maintain state on the server-side (user identity, preferences, shopping cart, activity, etc) </li></ul><ul><li>One method of maintaining state between HTTP requests is using cookies </li></ul>
  4. 4. What Is a Web Cookie? <ul><li>Web Cookie: a small piece of text generated by the web server and sent to the browser </li></ul><ul><li>Upon receiving the cookie, the browser: </li></ul><ul><ul><li>Stores the cookie in memory </li></ul></ul><ul><ul><li>Sends the cookie back to the web server each time it requests a new web page </li></ul></ul>www.apwebco.com
  5. 5. How Does a Cookie Look Like? <ul><li>A cookie is a name-value pair: </li></ul><ul><ul><li>cookie name = cookie value </li></ul></ul><ul><ul><li>Examples: </li></ul></ul><ul><ul><li>sessionID = AAA22311 </li></ul></ul><ul><ul><li>languagePreference = EN </li></ul></ul><ul><ul><li>headerColor = BLUE </li></ul></ul>www.apwebco.com
  6. 6. How Does It work <ul><li>Consider a user that browses a news website </li></ul><ul><li>Upon first page request (first visit), the web server issues a cookie (e.g. sampleCookie=A1A211 ) </li></ul><ul><li>The server sends the cookie and the page requested back to the browser </li></ul><ul><li>The browser stores the cookie in memory and sends it back to the server with each subsequent request </li></ul><ul><li>The server inspects each request; if the cookie is present, the server is able to maintain state regarding the user (identity, preferences, activity etc) </li></ul>www.apwebco.com
  7. 7. How Does It work sampleCookie=A1A211 sampleCookie=A1A211 News page, please! News page, and COOKIE sampleCookie=A1A211 Business page, please! ( sampleCookie=A1A211 ) Business page Sports page, please! ( sampleCookie=A1A211 ) Sports page browser WEB SERVER www.apwebco.com
  8. 8. Cookies and e-commerce <ul><li>Consider an e-commerce site that sells cosmetics and apparel </li></ul><ul><li>Upon first request (visit) each online shopper (browser) receives a unique cookie. The server ties each cookie to an individual shopping cart (data structure) </li></ul><ul><li>The server inspects each subsequent request, reads the cookie and updates the shopping cart associated with that cookie </li></ul>www.apwebco.com
  9. 9. Cookies and e-commerce Ana John Lipstick page, please! Lipstick page AND the cookie SessionID=A1A211 SessionID=A1A211 COOKIE: SessionID=A1A211 Socks page, please! Socks page AND the cookie SessionID=BBB333 SessionID=BBB333 COOKIE: SessionID=BBB333 Ana’s shopping cart John’s shopping cart browser browser WEB SERVER www.apwebco.com
  10. 10. Controlling Cookies www.apwebco.com
  11. 11. Happy Web Surfing! [email_address]