HttpWebRequest/HttpWebResponse

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Im trying to download a file from ISS Server.
But it returns back an error: 401 - Not authorized.
I tried everything.
Im getting mad in a fast pace.
If u could help me would be great.


HttpWebRequest req = (HttpWebRequest)WebRequest.Create(downloadUrl);
req.Credentials= new NetworkCredential("USER","PWD");
req.Method = "GET";
HttpWebResponse resp = (HttpWebResponse) req.GetResponse();

i get the error on the last line...why?

Thx
 
In your vdir properties on IIS machine turn off Windows Authentication and
switch on Basic Authentication
 
Back
Top