I have a WCF service hosted in IIS6. It is doing simple WebRequest.
When I call it from ASMX service(Hosted in the same IIS6). Everything is working great.
When I call it from WinForms application. Everything is also working as expected.
The problem arises when I call it from another WCF service.
Then response.GetResponseStream() throws 401 unauthorized error.
What am I doing wrong here?
System.Net.WebRequest request = WebRequest.Create(full_path_to_the_webpage);
request.Credentials = new NetworkCredential(username_for_http_login, password_for_http_login);
request.PreAuthenticate = true;
request.UseDefaultCredentials = false;
WebResponse response = request.GetResponse();
Stream responseStream = response.GetResponseStream(); //THIS line returns 401 Unauthorized