As per an ASP.NET page, on click of a button the following actions should happen:
- Download a file from server
Perform clean up actions like
- Hide a Button
- Set text to a label
- Display the label
- Disable a button
- etc.
Now the download part happens through the following code:
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename="+strFileName+".pdf");
Response.WriteFile(strBrowserPath);
And the remaining actions (Point 2) are done after.
Sadly, since Response.Clear()/Response.WriteFile() is used the remaining server side actions are not happening.
Any alternatives? Any fixes for this?