ASP.NET - download and save location - Asked By msakt on 29-Jun-12 01:25 AM

Byte[] bytes = (Byte[])dt.Rows[0]["BillImage"];
      Response.Buffer = true;
      Response.Charset = "";
      Response.ContentType = dt.Rows[0]["BillImage"].ToString();
      Response.AddHeader("content-disposition", "attachment;filename=" + dt.Rows[0]["comments"].ToString() + ".jpg");

this code is working for download but default save in downloads...i want save selected location c,d or e colon
KCH replied to msakt on 29-Jun-12 02:33 AM
hi,,, try this code  

protected void linkdownload_Click(object sender, EventArgs e)   {     path = Server.MapPath((sender as LinkButton).CommandArgument);       string fname = System.IO.Path.GetFileName(path);       FileInfo file = new FileInfo(path);       Response.Clear();       Response.ClearHeaders();       Response.ClearContent(); Response.AppendHeader("Content-Disposition", "attachment; filename = " + fname);          Response.AppendHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/download";           Response.WriteFile(file.FullName);       Response.Flush();           Response.Close();
Jitendra Faye replied to msakt on 29-Jun-12 02:51 AM
refer this link-

here you will example.