I have an 'Export' button on my page, when clicking this button, a file is
streamed to the client like this :
lblMessage.Text = "Thank you for downloading...";
System.IO.FileInfo objFI = new System.IO.FileInfo(FullFileName);
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition",
"attachment; filename=" + DownloadFileName);
System.Web.HttpContext.Current.Response.AddHeader("Content-Length",
objFI.Length.ToString());
System.Web.HttpContext.Current.Response.ContentType =
"application/octet-stream";
System.Web.HttpContext.Current.Response.WriteFile(objFI.FullName);
System.Web.HttpContext.Current.Response.End();
This works perfectly but after downloading, the page on wich the
download/export was initiated doesn't update, the lblMessage isn't updated
as is a button wich should become visible after download. I'm not sure how
to accomplish this.
Could anyone point me in right direction.
TIA,
Jurjen.
Peter Bromberg [C# MVP] - 28 May 2007 12:37 GMT
When you replace the Response with a file download and call Response.End,
that's the end of the Response and you will get no more.
I'd try issuing the download from a popup window that uses a second page,
leaving your first page alone.
Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
> I have an 'Export' button on my page, when clicking this button, a file is
> streamed to the client like this :
[quoted text clipped - 20 lines]
> TIA,
> Jurjen.