I have a scenario where I am using ASP.Net to redirect a page to a download page with the help of AJAX. The redirection is successful, the file is downloaded, and the calling page is displayed as expected. However, I need to execute some JavaScript code after the file has been downloaded in order to remove the waiting screen.
Currently, I am initiating the redirect first followed by the JavaScript call to unblock the user interface. To block the UI initially, I employ onclientclick='block()';
Response.Redirect("ExportFile.aspx", false);
ScriptManager.RegisterClientScriptBlock((this), this.GetType(), "alertAction", "alert('');unblock();", true);
Unfortunately, the alert doesn't seem to work, indicating that the JavaScript is not being triggered at all. I attempted placing the code on the file download page but that did not yield the desired outcome either. I even experimented with using body onpageunload, but that event never seems to be fired.
Could someone guide me on how to successfully redirect to a file download page and then invoke JavaScript to unblock the UI?