I am trying to download an image from a URL using the following code:
using (System.Net.WebClient webClient = new System.Net.WebClient())
{
NetworkCredential Cred = new NetworkCredential();
Cred.UserName = "user";
Cred.Password = "password^";
webClient.Credentials = Cred;
imageBytes = webClient.DownloadData(s);
}
However, I get the error : The remote server returned an error: (401) Unauthorized. There is no inner exception. I am giving my crendentials, and I am able to download the image when I paste them directly to IE. I am just not able to figure out what is causing this.