1 / 11

Maintaining Application State

Maintaining Application State. MIS3502: Application Integration and Evaluation David Schuff David.Schuff@temple.edu. The multi-page application? . Actually, we’ve been creating multi-page applications all semester.

emelda
Download Presentation

Maintaining Application State

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. Maintaining Application State MIS3502: Application Integration and Evaluation David SchuffDavid.Schuff@temple.edu

  2. The multi-page application? • Actually, we’ve been creating multi-page applications all semester …But the pages in our applications don’t communicate with each other, only with themselves (the postback), or an external data source (an Access database) Access database: glenside.mdb

  3. So? • This has worked because we are completing the entire transaction within a single page • Modification of a database record BUT • If you need to gather data across multiple pages to complete a transaction, then this doesn’t work • So you need a way to carry information across multiple pages

  4. What is “state” • Status of an application • i.e., what are the values of the application’s variables • The HTTP protocol is “stateless” • One page doesn’t know what another page is doing • So other things have to be done to get information from one page to another

  5. Why is this tricky? Multiple amazon.com sessions… amazon.com application server Each session must be treated separately (i.e., different items in the shopping cart) This information has to be kept track of somewhere…

  6. One option: Avoiding the issue (client-side) • Post data from a form to a page • This treats each page like a separate component • Data has to be “handed off” from one component to another • There are some odd ways this gets implemented • Hidden HTML fields, complex URLs ASP.NET applications are set up to post data to themselves. This happens when we enable “AutoPostBack” in a DropDownList, or when a Button is clicked.

  7. How to maintain state: Server-side • The “session state” object • ISAPI (Internet Server API) – Microsoft standard for doing this • The application running at the server maintains the state for every connected session • Communicates its state with the client

  8. Session state object • Goes away when the browser is closed • Data is lost • Is persistent across pages of the same browser session • Can hold any data type =

  9. How to maintain state: Client-side (cookie) Me like retaining values across multiple browser sessions! • The browser keeps track of data for other pages to “pick up” later • Small text files saved to the local hard drive • Does not go away when browser is closed (persistent) • Can only hold string values

  10. When to use each? • What situation would you want to use a session variable? • What situation would you want to use a cookie? • Is there one which you should avoid using?

  11. Summary: Session Variables versus Cookies Session Variables Cookies Server’s memory (RAM) Server’s memory (RAM) State information about a session is maintained at the server State information about a session is maintained at the browser

More Related