title: Save image from Image.Control to website directory
body: <p>Is there a way to save an image from a .net Image Control to the server's directory?</p>
  
  <p>It's a barcode image that gets generated on Page_Load:</p>
  
  <pre><code>Image1.ImageUrl = "~/app/barcode.aspx?code=TEST"
  </code></pre>
  
  <p>The barcode image displays just fine on the webpage, but I wnated to save it to a directory as well:</p>
  
  <p><code>~/barcode image/TEST.jpg</code></p>
  
  <hr>
  
  <p>So far, here's what I have:</p>
  
  <pre><code>WebClient webClient = new WebClient();
  string remote = Server.MapPath("..") + @"\app\barcode.aspx?code=TEST";
  string local = Server.MapPath("..") + @"\barcode image\TEST.jpg";
  webClient.DownloadFile(remote, local);
  </code></pre>
  
  <p>But it gives me an error: <code>Illegal characters in path.</code></p>