A
anassar
I have an ASP.Net Web Application where I depended on Sessions to share
information across the code. One of the buttons the user clicked, take
a long time to process. So, I started multi-threading the function
behind that button, but then I hit a brick wall - the new thread has no
access to Context.Current and therefore cannot see the Session
variables.
I understand why threads should not depend on Context.Current as they
can outlive the context's lifespan. I also understand that I can pass
the User Information that was stored in a Session as a parameter to my
thread. The problem is that I have 100's of functions I wrote that
depended on Session and now I have to go through all of them to
accomodate the thread limitation.
My question is: Is there a Cache I can depend on at the thread level to
store User Information that I can share and access from all of my
functions ?
BTW, I use classes within classes so I have several levels on hierarchy
and passing information down/up that tree is non-trivial. I am looking
for cache that I can access from anywhere on that thread.
I have a unique ID per thread. So, one thing I thought of doing is to
put a HashTable on the Application stack in Global.asax where the key
is that Unique ID. But then how do I propagate that Unique ID
throughout all the functions in that thread ? I still come to the same
problem - I need some cache space that can be accessed from any
function or class on that thread.
Please help as I have spun my wheels for days now.
Aladdin
information across the code. One of the buttons the user clicked, take
a long time to process. So, I started multi-threading the function
behind that button, but then I hit a brick wall - the new thread has no
access to Context.Current and therefore cannot see the Session
variables.
I understand why threads should not depend on Context.Current as they
can outlive the context's lifespan. I also understand that I can pass
the User Information that was stored in a Session as a parameter to my
thread. The problem is that I have 100's of functions I wrote that
depended on Session and now I have to go through all of them to
accomodate the thread limitation.
My question is: Is there a Cache I can depend on at the thread level to
store User Information that I can share and access from all of my
functions ?
BTW, I use classes within classes so I have several levels on hierarchy
and passing information down/up that tree is non-trivial. I am looking
for cache that I can access from anywhere on that thread.
I have a unique ID per thread. So, one thing I thought of doing is to
put a HashTable on the Application stack in Global.asax where the key
is that Unique ID. But then how do I propagate that Unique ID
throughout all the functions in that thread ? I still come to the same
problem - I need some cache space that can be accessed from any
function or class on that thread.
Please help as I have spun my wheels for days now.
Aladdin