Problem in downloading file
-
Hi all, I am writing the following code to download the word document when button clicked... when i clek the button it open a popup window "File download".. in this popup there are open,save,cancel and moreinfo buttons are avaliable. When i click the save,cancel and moreinfo buttons, it is nicly working. when i click the open button.. it again diaplay the same popup window "File download" ,again i click the open .. now it is opening... But when i click the open button first it doesn't open the file instead of it again show the File download popup.. how to sole this problem. The code with in the button click is: string filename="Doc1.doc"; if (filename != "") { string path = Server.MapPath(filename); System.IO.FileInfo file = new System.IO.FileInfo(path); if (file.Exists) { Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(file.FullName); Response.End(); } else { Response.Write("This file does not exist."); } } pls any one give me the solution Paul