How to use HttpSessionState with SqlState

F

forinti

Is it possible to use the Session object, with SqlState, when outside
of a request scope?

I have some very slow queries that I fire asynchronously, while the
user sees a wait page. Therefore, when my results are ready, I don't
have HttpContext.Current. Even though I can save a reference to the
current Session object, I'm not sure I can rely on it, since I have
SqlState configured (actually I'm still developing with InProc).

Any help with this will be greatly appreciated.

Thanks.
 
B

Bruce Barker

not really. with non inproc state servers the following happens

BeginRequest

deserialize Session Store to new Session Object

request processing

serialize Session object to Session Store
End Request

this means if you hold a reference to a Session object in a background
thread you can read it, but updates won't be refected in the store. with the
inproc, no serialization happens, a reference is passed around, so its
always the same object.

you should create a background request queues, with a pool of request
threads. use an input and output queue.

then your page processing looks like:

client request
queue up long request request
store reqid in session
return to client

client poll
if reqid not done return to client
else
remove response for reqid from queue
process response
return to client

-- bruce (sqlwork.com)
 
F

forinti

This was very helpful, thank you very much!

There is just one extra complicating factor: I'll have a web farm in
production.
So I suppose I'll have to have this queue in the database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top