Proxy Basic Authentication in C#: HTTP 407 error

后端 未结 6 1969
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 05:18

I am working with a proxy that requires authentication, i.e., in a browser if I try to open a page it will immediately ask for credentials. I supplied same credentials in my

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 06:11

    This problem had been bugging me for years the only workaround for me was to ask our networks team to make exceptions on our firewall so that certain URL requests didn't need to be authenticated on the proxy which is not ideal.

    Recently I upgraded the project to .NET 4 from 3.5 and the code just started working using the default credentials for the proxy, no hardcoding of credentials etc.

    request.Proxy.Credentials = CredentialCache.DefaultCredentials;
    

提交回复
热议问题