Proxy Basic Authentication in C#: HTTP 407 error

后端 未结 6 2020
伪装坚强ぢ
伪装坚强ぢ 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:19

    try this

            var YourURL = "http://yourUrl/";
    
             HttpClientHandler handler = new HttpClientHandler() 
             { 
                 Proxy = new WebProxy("http://127.0.0.1:8888"), 
                 UseProxy = true, 
             }; 
    
             Console.WriteLine(YourURL); 
    
             HttpClient client = new HttpClient(handler); 
    

提交回复
热议问题