Click here to Skip to main content
16,019,107 members

Comments by aamirsajjad (Top 1 by date)

aamirsajjad 25-Jul-13 5:18am View    
Please do this , Also save file on client Machine. i am facing the same problem in asp.net , solution is there

string url = deg + "\\" + file;
WebClient wc = null;

string path1 = "~/temp/";
string filename = DateTime.Now.Ticks + ".tmp";

wc = new WebClient();

wc.DownloadFile(url, Server.MapPath(path1 + filename));

Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("ContentType", "application/octet-stream");
Response.AddHeader("Content-Disposition", "attachment;filename=" + file);

Response.WriteFile(Server.MapPath(path1 + filename));

Response.End();