Is there a way to save an image from a .net Image Control to the server’s directory?
It’s a barcode image that gets generated on Page_Load:
Image1.ImageUrl = "~/app/barcode.aspx?code=TEST"
The barcode image displays just fine on the webpage, but I wnated to save it to a directory as well:
~/barcode image/TEST.jpg
So far, here’s what I have:
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);
But it gives me an error: Illegal characters in path.
WebClientrequires a web address for the remote parameter – you are giving it a local path for this parameter.Additionally
Server.MapPathexpects a proper directory – not...