We are building a AJAX enabled web application that makes multiple asynchronous requests to the server. Each of these server requests are long running server tasks with each returning back a JSON object to the html page. Each of these calls need read/write access to the Session object.
But the ASP.NET locks the session object when multiple asynchronous tasks are in process, thus blocking the first asynchronous call. So these asynchronous calls never happen in parallel.
PS: The asynchronous calls are PageMethod calls.
Are Sessions are 'not' recommended in the first place when used along-side asynchronous calls. Any other suggestions on designing this asynchronous request model will be highly appreciated.
Thanks to everyone that posted answers and comments to my question. I'm summing up my findings and solution so that someone may find this useful.
Everyone that commented is correct about recommending not to use Sessions in asynchronous calls. So, how did I get around it?
With the above solution, multiple async calls are possible with each call reading into the session object
For more information about making a Jquery call to a HTTP Handler returning a JSON object, here's the link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With