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] -

Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Categories
Archive
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
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)