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, th开发者_StackOverflowe 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?
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
You can use query string parameter say isshow=true
or isshow=false
and in your frmCancelWfSearch.aspx
depending on the value of this parameter you can change the value of your session variable. You can send query string params when using POST
like this: xmlHttp.send("isshow=false");
精彩评论