By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

How to redirect output back to browser after Response.WriteFile download???

P: n/a
I have a datagrid with a download button that raises the itemcommand event.
In the event handler for this event, I have the code below. The problem is
that the download code requires a Response.End() in order to stop further
output the the response stream(such as the posted back page itself). Is
there a way to divert the output stream back to the browser after the file
has downloaded without using a Response.End() (which ends all page
processing) ???

If I can find that, then the postback can occure and my databindgrid will
work and everything is fixed!

Thanks in Advance

Earl

.....
dl.UpdateDownloadDate(pkDownloadMaster,System.Date Time.Now);

DataBindGrid(dl.SelectOrderNo(pkDownloadMaster));

string filename= "downloadfile.txt";

string filepath = Page.MapPath(".") + "\\" + filename;

Response.Clear();

Response.ContentType = "application/octet-stream";

Response.AddHeader("Content-Disposition", "attachment; filename=\"" +
filename + "\"");

Response.WriteFile(filepath);

Response.End();
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.