how to download files to a specified client folder from server without showing open/save promptin asp.net application?
if (e.CommandName == "download_file") { string filename=e.CommandArgument.ToString(); string path=MapPath("~/files/" + filename); byte []bts=System.IO.File.ReadAllBytes(path); Response.Clear(); Response.ClearHeaders(); Response.AddHeader("Content-Type", "Application/octet-stream"); Response.AddHeader("Content-Length",bts.Length.ToString()); Response.AddHeader("Content-Disposition","attachment; filename=" + filename); Response.BinaryWrite(bts); Response.Flush(); Response.End(); }
if (e.CommandName == "download_file") { string filename=e.CommandArgument.ToString(); string path=MapPath("~/files/" + filename); byte []bts=System.IO.File.ReadAllBytes(path); Response.Clear(); Response.ClearHeaders(); Response.AddHeader("Content-Type", "Application/octet-stream"); Response.AddHeader("Content-Length",bts.Length.ToString()); Response.AddHeader("Content-Disposition","attachment; filename=" + filename); Response.BinaryWrite(bts); Response.Flush(); Response.End(); }