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

E

Earl Teigrob

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.DateTime.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();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top