Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to run async call to set a session in ASP.NET?

I have a page that access Database running a heavy stored procedure and return a result, the result will be displayed depending on a session variable Session["isShown"] for example.

I would like to using Ajax to call another page to set :

 xmlhttp.open("POST", "frmCancelWfSearch.aspx", true);
 xmlhttp.send();

how to run frmCancelWfSearch.aspx asynchrounously to set that Session["isShown"] to false?

like image 857
Bart Avatar asked Nov 05 '22 16:11

Bart


1 Answers

Implement your server code in an IHttpAsyncHandler and also implement IRequiresSessionState so you have access to the session.

http://msdn.microsoft.com/en-us/magazine/cc164128.aspx

like image 187
Samuel Neff Avatar answered Nov 15 '22 05:11

Samuel Neff