I am using ASP.NET2.0. I created a upload form with some input fields and a upload button. When the download button is clicked, I want to redirect the user to the "Thank you for downloading ..." page and immediately offer him a file to save.
I have the following code to display the savefile dialog box:
public partial class ThankYouPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.AddHeader("Content-Disposition",
"attachment; filename=\"downloadedFile.zip\"");
Response.ContentType = "application/x-zip-compressed";
Response.BinaryWrite(this.downloadedFileByteArray);
Response.Flush();
Response.End();
}
}
Obviously, this code does not allow the message “Thank you” to be displayed. Is there an “AfterRender” event or something similar on the page where I could move this download code and let the page send a “thank you” message to the user? In the end, I am sincerely grateful to them, so I want to express this.