Re: Accessing session from thread



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
>


.



Relevant Pages

  • Re: How to access the Session object from a new thread ?
    ... > Where are you getting 'Session', is that the object you are passing in? ... > context for the new thread, which doesn't exist, hence the null reference ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to access the Session object from a new thread ?
    ... > Where are you getting 'Session', is that the object you are passing in? ... > context for the new thread, which doesn't exist, hence the null reference ...
    (microsoft.public.dotnet.framework.aspnet)
  • how to keep track of the session ID across domains
    ... want to identify and keep track of every single user that surfs our ... The problem is how to keep track of the session ID across domains. ... - automatic passing in links by the use of trans_id doesn't work. ... The result were different Session IDs even for websites on the same ...
    (comp.lang.php)
  • Re: [PHP] Keeping file pointers open after script end
    ... so that it can be access later, by passing it through session? ... Well, okay, *MAYBE* you could hack something up with execand fork ...
    (php.general)
  • Re: Avoid GET method
    ... : Is there a way to make a text link post to a form without passing all: the parameters in the url? ... protect that id from being known or accessible or usable from the 'hidden' information. ... one method is to create a record in the session of ... Gravity beer in Essex. ...
    (comp.lang.php)

Loading