RSS 2.0
# Wednesday, April 15, 2009

I frequently find myself storing a business object in Session, for ease of use across various pages.  One issue that frequently occurs is that the session will timeout (if the user walks away from their computer for a while, etc...), and when work resumes on the page, the object no longer exists. 

To remedy this, I like to store the ID (primary key, etc...) of the object, as a string, in a COOKIE, and in the Page_PreLoad I check the state of the session object, and if it is non-existent, but I do have a cookie value, it is easy to quickly re-populate the session object using the ID.

This is a quick and light way to help fight the war against maintaining state in a state-less environment.  There are more advanced ways of maintaining state, like using SQL Server to maintain state, and it is up to the developer to choose the most effective method of state management for each project.

Wednesday, April 15, 2009 6:21:59 AM (Mountain Standard Time, UTC-07:00)  #    Comments [0] -

Categories
Archive
<April 2009>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
GeekzRule.com
Sign In
Statistics
Total Posts: 12
This Year: 0
This Month: 0
This Week: 0
Comments: 0
Themes
Pick a theme:
All Content © 2010, GeekzRule.com
DasBlog theme 'Business' created by Christoph De Baene (delarou)