How can I use the Webrequest Credentials
Property to send an basic authentication header?
Why isn\'t the Authorization header send with the request even when
I can successfull run this code accessing another server that also requires both SSL and authentication. This server differs from the github in that the github returns a json result saying that it requires authentication and the other server returns a "classic" 401 html page. Sniffing the network you can see that the .net code tries to do anonymous auth even if you do set preauth to true which I think is rather confusing. However, upon receiving a regular 401-page it tries again, and this time with the auth info and everything works. It seems to me though as if .net reacts differently upon receiving the json version of a 401, not making a second try.
I guess this is not the answer you are looking for but hopefully it sheds some more light on the situation.