Best way to maintain web application state?
-
Hi, I´m a really confused about what is the best way to maintain asp.net page state (viewstate, session, profiles): Nr 1: are all objects destroyed when a page request has finished and returned the html/aspx page? If that’s the case it conveys that I have to re-create all objects when a new request is made and “re-fill” objects with values? Or? Nr 2: What is the usual way to “save” a users state variables? Regards /Christoffer
-
Hi, I´m a really confused about what is the best way to maintain asp.net page state (viewstate, session, profiles): Nr 1: are all objects destroyed when a page request has finished and returned the html/aspx page? If that’s the case it conveys that I have to re-create all objects when a new request is made and “re-fill” objects with values? Or? Nr 2: What is the usual way to “save” a users state variables? Regards /Christoffer
For information that needs to tracked across multiple post backs a) Use View State - If the information is tied to a single page & If the information consists of fewer bytes b) Use Profile - If the information represents specific to the logged user on the whole rather than a page or group of page c) Use Session - Information that needs to be tracked for the user, that applies to your application on the whole again use session variables, again you may not want more than few 100 bytes of information as part of session d) Database - If you need to track information for ordering of records and if you have few thousands records always re-request it from the database instead of storing it in session variables e) Cache - If information is common across all connected users.