HttpWebRequest with Digest authentication returns error 401 in metro app (windows 8)

I'm developing an app for Windows 8 (metro app) that needs to download some content from a server that requires Digest authentication.

This is the code I'm using to send the request:

WebRequest webRequest = WebRequest.Create("http://my_site_with_http_digest_auth");
webRequest.Method = "GET";
webRequest.Credentials = new NetworkCredential("user", "pass");
webRequest.UseDefaultCredentials = false;
HttpWebResponse webResponse = (HttpWebResponse)await webRequest.GetResponseAsync();
if (webResponse != null && webResponse.StatusCode == HttpStatusCode.OK)
    // Analyze response here...

When I run this code in a metro app, the server returns 401 (authentication error). The exactly same code runs well on Windows Phone and a normal .NET app. This only happens on Windows 8 metro app. Maybe this is a bug in WinRT. Someone else has experienced this problem in metro apps? Any tip?


Potentially this is another manifestation of a more general bug in .NET Framework

(voting not allowed on that one!)

And another report:

And (with bizarre MSFT response):


Implement Digest authentication via HttpWebRequest in C#

Need Your Help

Best strategy for adding or updating a collection of related entities when using the EF4?

c# .net entity-framework

Let's say you have a Classroom entity with an collection of Student entities. What I usually do when creating a new Student and need to add it to the Classroom is use Classroom.Students.Add(newStud...

function F() { if (!(this instanceof F)) { return new F() }; ... }


What is the usage of the construct: function F() { if (!(this instanceof F)) { return new F() }; ... }?