Re: Store Asyncresult to session with sessionState mode = "SQLServer"
- From: "Günter Prossliner" <g.prossliner/gmx/at>
- Date: Mon, 9 Oct 2006 17:58:50 +0200
Hi!
but I opted for a considerably simpler option
that seems to work perfectly. I wanted to store the result in the
session so I could maintain separate asynchronous operations for each
logged in user.
Cache("result" + Session.SessionID) = ar
Ok. But be aware that:
* A new Session may get the same SessionID again (because when a Session
ends the cookie remains within the Browsers memory). So it is no bad idea to
clear the value from the cache within Session_Start
* Cache items may get removed from the Cache automaticly. There are memory -
limits for the cache. At least you should insert the objects with the
CacheItemPriority.NotRemovable.
I would still recommend that you use static Fields instead of the Cache to
avoid the unnessersary overhead of the Cache Object because you do not need
the things that the Cache Object offers you (like expiration, dependecies
and auto-remove), you just want to store a Object-Reference within memory.
You can use the SessionID as a key within the helper - property:
static class AsyncResultManager {
public static Dictionary<string, IAsyncResult> _dic = new ...();
public static IAsyncResult UserAsyncResult {
get{
return _dic[HttpContext.Current.Session.SessionID];
}
set{
_dic[HttpCOntext.Current.Session.SessionID] = value;
}
}
}
GP
.
- References:
- Store Asyncresult to session with sessionState mode = "SQLServer"
- From: sean . swords
- Re: Store Asyncresult to session with sessionState mode = "SQLServer"
- From: Chris Taylor
- Re: Store Asyncresult to session with sessionState mode = "SQLServer"
- From: sean . swords
- Re: Store Asyncresult to session with sessionState mode = "SQLServer"
- From: Günter Prossliner
- Re: Store Asyncresult to session with sessionState mode = "SQLServer"
- From: sean . swords
- Store Asyncresult to session with sessionState mode = "SQLServer"
- Prev by Date: Re: Store Asyncresult to session with sessionState mode = "SQLServer"
- Next by Date: Re: Switching to local data objects when Remoting fails
- Previous by thread: Re: Store Asyncresult to session with sessionState mode = "SQLServer"
- Next by thread: StackBuilderSink and ServerIdentity VERSUS memory leak...
- Index(es):
Relevant Pages
|