Re: Accessing session from thread
- From: "John Timney \( MVP \)" <timneyj@xxxxxxxxxxxxx>
- Date: Fri, 25 Nov 2005 20:07:20 -0000
As long as the pipeline is still active, then the context of the session may
be available, but its always a risky thing to rely on, and you might be
better taking a snapshot of session items into a collection at thread start
and passing that to the thread, rather than maintaining access to the live
session.
Read this for a pointer:
http://www.odetocode.com/Articles/112.aspx
--
Regards
John Timney
ASP.NET MVP
Microsoft Regional Director
"John" <jsparrowNOSPAM@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:uLLhtNf8FHA.956@xxxxxxxxxxxxxxxxxxxxxxx
> Is there a safe way to gain access to the session object from inside a
> spawned thread, in ASP.NET?
>
> I'm familiar with the principle of creating a data storage object, passing
> a reference to the thread, and then adding the object to the session. But
> this won't work when using StateServer because of serialization (session
> only contains a snapshop of the object at the point I added it, and the
> changes made by the thread occur elsewhere).
>
> Ideally I'd like:
>
> void MyThreadWorker()
> {
> HttpSession sess = somemagicroutine();
> sess["counter"] = 1;
> }
>
> Thanks,
>
> John
>
.
- Follow-Ups:
- Re: Accessing session from thread
- From: John
- Re: Accessing session from thread
- References:
- Accessing session from thread
- From: John
- Accessing session from thread
- Prev by Date: Unable to start debugging on the web server. Catastrophic failure
- Next by Date: can't see properties on user control from aspx.vb
- Previous by thread: Accessing session from thread
- Next by thread: Re: Accessing session from thread
- Index(es):
Relevant Pages
|
Loading