1

I have the following use case: A user can filter on my asp.net web project for some data and request the result as PDF. The PDF is generated per request new and returned to the user. I got already everything to run.

But: the processing can take up to two minutes and the user should be able to continue to use the page.

I tried to use a second tab, but both tabs are blocked. Even when I use the PageAsyncTask class and the async attribute. When I use a thread to perform the request, I am truly parallel, but I have no clue, how to interact with the user from inside the thread when the work is done.

How can I send an async request to the server and just get the result on the page, in whatever form, when its finished?

4
  • Is this a single-page application. I ask because is there anything to prevent the user from navigating to another page without realizing the PDF would no longer be delivered? Commented Oct 18, 2013 at 15:57
  • 1
    Without knowing a whole lot about your app, I think you might want to look at SignalR. It facilitates real-time communication (where possible...it will resort to polling for older browsers). You could set up an event on your server that indicates that the PDF is ready, and alert the client that it is ready to be downloaded. Commented Oct 18, 2013 at 15:59
  • I like the concept. But how can I make an async call? When I use a background worker, my page gets slowly. Commented Oct 21, 2013 at 14:56
  • 1
    The BackgroundWorker class is used mostly for Windows Forms. Async with web means that your browser brings up a page, but then communicates in the background with a web service via AJAX. Commented Oct 22, 2013 at 11:38

1 Answer 1

1

Dave Encosia does a great job explaining how you can do this:

Sign up to request clarification or add additional context in comments.

3 Comments

The concepts Dave present are exactly what I needed. I wrote a test project and it worked fine. When I integrate it to my real project, the page get stuck until the web service call finished. By any chance you could give me a hint?
@StafanG - That's awesome. Glad those links helped you. They helped me when I first started learning about it. With regards to your issue, what I tend to do to troubleshoot is comment out everything but what it takes to do the async call and then start adding things back in until it breaks.
For anybody facing the same problems. That's my final solution: I used Dave Encosia's idea and had to set all async request pages to EnableSessionState="ReadOnly"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.