I'm trying to download a .axd picture link, but I'm getting not found error(404). In local server, works fine, but I get 404 on production Server. Is there anything I must to set up in web.config or something?
public System.Drawing.Image DownloadImage(string url)
{
using (var webClient = new WebClient())
{
byte[] fileBytes;
try
{
fileBytes= webClient.DownloadData(url);
}
catch (WebException ex)
{
// (HttpWebResponse)ex.Response).StatusCode
Util.GerarLog("DownloadImage", ex.Message + " " + ex.InnerException + "URL: " + url + "Response: " + ((HttpWebResponse)ex.Response).StatusCode.ToString(), "Image");
throw new Exception(ex.Message + " " + ex.InnerException);
}
return ByteArrayToImage(fileBytes);
}
}
public static System.Drawing.Image ByteArrayToImage(byte[] fileBytes)
{
using (var stream = new MemoryStream(fileBytes))
{
return System.Drawing.Image.FromStream(stream);
}
}