PC Review


Reply
Thread Tools Rate Thread

ASP.NET 2.0 - How to refresh page after download

 
 
Jurjen de Groot
Guest
Posts: n/a
 
      28th May 2007
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.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      28th May 2007
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




"Jurjen de Groot" wrote:

> 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.
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Async method raised in web page doesn't refresh page TS Microsoft ASP .NET 8 27th Jul 2005 08:40 AM
Async method raised in web page doesn't refresh page TS Microsoft C# .NET 6 27th Jul 2005 08:40 AM
Download IP Refresh 1.5.5 Deon Windows XP General 2 3rd Apr 2005 02:48 PM
Page.SmartNavigation = True (Button click and Page refresh issue) Lenny Shprekher Microsoft ASP .NET 0 23rd Feb 2005 06:39 PM
BCM BETA2 refresh download horrors! S Millar Microsoft Outlook Contacts 1 15th Jul 2003 07:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:22 AM.