title: Cannot download files/images from uploads folder in asp.net
body: <p>i need to download images that i stored in folder in <code>asp.net</code> web application name as <code>uploads</code></p>
  
  <p>i got a function that should download this as</p>
  
  <pre><code>private void downloadAnImage(string strImage)
  {
      Response.ContentType = "image/jpg";
      Response.AppendHeader("Content-Disposition", "attachment; filename=" + strImage);
      Response.TransmitFile(strImage);
      Response.End();
  }
  </code></pre>
  
  <p>and i call this function from <code>link button</code> as</p>
  
  <pre><code>protected void lnkDwnSlc_Click(object sender, EventArgs e)
  {
      if (Session["slc_filepath"] != null)
      {                 
           string path = Server.MapPath(Session["slc_filepath"].ToString());
           downloadAnImage(path);
      }
  }
  </code></pre>
  
  <p>where <code>Session["slc_filepath"]</code> is path stored in <code>session</code> </p>
  
  <p>but after running this code file/image is not downloading and I got no error about why file is not downloading. And I checked file path by using <code>breakpoint</code> , it is correct, </p>
  
  <p>I search a lot form google but i can't understand where I missed something.</p>
  
  <p><strong>EDIT:</strong>
  on page load event i pull records from table there i saved path of file and in session i store it like </p>
  
  <pre><code>Session["slc_filepath"] = dt.Rows[0]["UploadSLC"].ToString();
  </code></pre>
  
  <p>where <code>UploadSLC</code> is column name of table where i store path of image
  and in database string is looking as</p>
  
  <pre><code>~\uploads\ab071770-473a-4e1a-8cfc-addeccf565d5.jpg
  </code></pre>