I am testing an application with a local Web server (IIS, Windows 8), the site requires Basic authentication, and as long as I explicitly pass my credentials, everything works fine:
request.Credentials = new NetworkCredential("User", "Password", "Domain");
request.PreAuthenticate = true;
But I would like to use integrated security, so I tried to change the first line as follows:
request.Credentials = CredentialCache.DefaultNetworkCredentials;
(I also tried DefaultCredentials)
I checked the network traffic with Fiddler, and I see that in the second case Http request is sent without an authorization header, so it's not surprising that it fails. But why?
UPDATE. I believe I misunderstood default credentials concept. DefaultNetworkCredentials may not be used to generate basic authentication header, it must be a user/password pair. So this behavior is by design.