470,815 Members | 1,256 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Creating Specialized Session State Store

I'm trying to hook in a specialized state store server into ASP.NET.

I understand I can create a HttpModule and hook the events
OnAcquireState and OnReleaseState. So far so good.

But, it seems that the framework owns the HttpSessionState instance
(HttpContext.Session) and so my state store module must use the Add,
Remove and Clear methods to interact with the store. ie. on Acquire, I
need to call HttpSessionState.Add to add all the persisted state
variables into HttpSessionState and on Release, I need to persist the
state from HttpSessionState back to my store. To do this I can just
use the indexer in HttpSessionState.

But this is going to be slow as I will be saving and restoring the
entire session state. If the session state is very large, I wan't to
only persist those items that have changed. I could keep a copy and
compare what has changed, but that will be 2x the session data and is
also an overhead.

What I'd really like is a lower level interface so that I could only
save session state items that have changed and not have to serialize
the entire state on Release. Since HttpSessionState owns the in-memory
session state dictionary, I can't see how I can do this. I'd really
like to create my own HttpsessionState instance and control every
set/get to the HttpSessionState. To do this I need to set the instance
pointer in HttpContext. I'd like to do this in my module's
BeginRequest event. But, the problem is there is no SetSession method
in HttpContext to use.

Any ideas ?
Nov 18 '05 #1
0 1202

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Leon | last post: by
3 posts views Thread by Nhi Lam | last post: by
2 posts views Thread by adam | last post: by
3 posts views Thread by Matt Mercer | last post: by
7 posts views Thread by Mr Newbie | last post: by
5 posts views Thread by Steven Blair | last post: by
11 posts views Thread by Glenn | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.