0

This question may be asked a lot times. But i didn't find an exact solution for this, that is why i am asking it.

We are working in a project, where it got an update process. There is download functionality to download an exe. We are using a handler to download the file. Its code is given below

.ashx

string filename = System.IO.Path.GetFileName(fileUrl);    
context.Response.ClearContent();
context.Response.ContentType = "application/exe";
context.Response.AddHeader("content-disposition", String.Format("attachment; filename={0}", filename));
context.Response.TransmitFile(fileUrl);

So we are calling this handler on a button click like:

Click event

Response.Redirect("Test.ashx?fileUrl=" + downloadUrl, false);

Then its downloading the file.

Now we got a timer in our page. After download i want to enable that timer. How can i do this after the download. When i am giving it just below the Redirect like Timer1.Enabled= true; its not working. Can anyone please suggest a way to do this.

Mahesh KP
  • 6,248
  • 13
  • 50
  • 71
  • try, Timer1.Enabled= true; just above Response.Redirect("Test.ashx?fileUrl=" + downloadUrl, false); – Matt Jul 11 '12 at 06:16
  • @user970349: yes.. i tried that too... its not working.. i think because we are clearing the response content at the top of the handler.. – Mahesh KP Jul 11 '12 at 06:19
  • @user970349: k .. but i think this is a common problem.. and someone will have a solution ? dont know.. – Mahesh KP Jul 11 '12 at 06:29

1 Answers1

1

Use an iframe in the page and set its src to another .aspx page and put your download code in that aspx page. Before or after setting src enable timer.

Matt
  • 1,953
  • 1
  • 19
  • 42