Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Creating Specialized Session State Store (http://www.velocityreviews.com/forums/t73803-creating-specialized-session-state-store.html)

Michael O'Brien 02-23-2004 09:54 PM

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 ?

Alvin Bruney [MVP] 03-02-2004 06:34 AM

Re: Creating Specialized Session State Store
 
Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Michael O'Brien" <mob@mbedthis.com> wrote in message
news:f3f46865.0402231354.48c66cc2@posting.google.c om...
> 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 ?





All times are GMT. The time now is 02:58 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.