I am trying to generate a pdf on a fly at runtime from a database, The application is working fine, but I am wondering if I can show a progress bar until the pdf is generated with out using ajax.
Here is my Action to generate PDF
public ActionResult GeneratePDF(){
//This Generates PDF
return ...
}
Now I want to show a progress bar info until the PDF is generated, some thing like this
public ActionResult GeneratePDF(){
//show progress
...............
//This Generates PDF
return View();
}
public ActionResult ShowProgress(){
//Show progress
......
//return to GeneratePDF to show pdf when it is ready
return RedirectToAction("GeneratePDF");
}
I appreciate for any suggestions on how to handle this.
I don’t think you can do this. Even if you could continue like this on the server side, once the browser gets a response from its initial request it won’t know what to do with anything else that comes in later.
The HTTP protocol in fundamentally built on a concept of request-response, request-response – and it’s the browser that’s in the driver’s seat, not the server. AJAX is the way to go for this kind of client-side UI richness.