1 / 21

ASP .Net, Web Forms and Web Controls

ASP .Net, Web Forms and Web Controls. Outline Session Tracking Cookies Session Tracking with HttpSessionState. Session Tracking . Personalization Tailored to client’s needs Creates customer loyalty Requires a Session ID – represents a unique client Tradeoff: Privacy protection

sevilen
Download Presentation

ASP .Net, Web Forms and Web Controls

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. ASP .Net, Web Forms and Web Controls Outline Session Tracking Cookies Session Tracking with HttpSessionState

  2. Session Tracking • Personalization • Tailored to client’s needs • Creates customer loyalty • Requires a Session ID – represents a unique client • Tradeoff: Privacy protection • Release of vital, possibly private, data • Tracking achieved by using • Cookies • ASP.NET’s HttpSessionState object • Hidden input form elements and URL tracking

  3. Cookies • Cookies • Text file stored by a Web site on a individual’s computer that allows the site to track the actions of the visitor • Records sites that the user visits and identifies shopping preferences • Cookies can store name-value pairs • Web Server can never access cookies created outside the domain associated with that server • Cookie’s Expires property (default is browsing session)

  4. OptionsPage.aspx.cs Program Output Server creates a cookie that stores a record of the chosen language, as well as the ISBN number for a book. When user clicks hyperlink, the cookies previously stored on the client are read and used to form a list of book recommendations

  5. Defines five radio buttons Label Web control

  6. Request current page, does not cause a postback OptionsPage.aspx

  7. Define books as a Hashtable, stores key-value Add values to Hashtable

  8. Three hyperlinks are made visible Determines whether the user selected a language

  9. Cookie is added to the cookie collection sent as part of HTTP response header Returns value corresponding to key contained in language New cookie object created to store language and ISBN number

  10. Label displays text recommendations Displays the recommendations created by the code-behind file

  11. Method to retrieve cookies from the client Ensure that there is at least one cookie Add information in other cookies into list box Execute if no language was selected

  12. RecommendationsPage.aspx.cs Program Output

  13. Session Tracking with HttpSessionState • HttpSessionState • HttpSessionState objects can store any type of objects (not just Strings) as attribute values • Example modified: • The ASPX file is similar

  14. OptionsPage.aspx.cs Program Output

  15. Session Tracking with HttpSessionState • Every Web Form includes an HttpSessionState Object, accessible through property Session of class Page • Use this property Session to manipulate page’s HttpSessionState object.

  16. Options.aspx

  17. Indexing the Session object with key name Event handler PageInit retrieves session information Iterates through the Session object

  18. Program Output

More Related