views:

78

answers:

2

I have a UserInfo object that is generated on each page_prerender event. This object is generated from the db and contains general info and permissions info. Since this object is always the same for each user - unless the user updates his profile - I'd like to cache it.

Does anyone know how I would do so per user (as each user of the web app has a different userinfo object) and get the new values into the cache when a profile is updated.

Any help is great! thanks!

+1  A: 

Store the object as a session object in the session start event

this.Session["UserInfo"] = myUserInfo;

Update this object when the user updates there profile.

Paul Creasey
Is this the best solution? It seems like there would be some drawbacks down the road with this approach...?
rksprst
Also, I don't think the session exists in the prerender event.
rksprst
The session starts when the user first arrives at the site and is preserved until it times out, or is programatically eneded. the session state is available at the prerender event.
Paul Creasey
Thanks, works great... site is much faster.
rksprst
A: 

May be it worth to add issue a cookie for each user. If you will stop the application the session may be lost

B-Rain