Proxy Authentication in .NET - for external API

前端 未结 2 836
梦毁少年i
梦毁少年i 2021-02-03 13:53

I\'m developing a twitter messaging utility using Twitter API (twitterizer). But since I\'m within a corporate proxy, I\'m getting the error \'407 Proxy Authentication Required\

2条回答
  •  爱一瞬间的悲伤
    2021-02-03 14:20

    One of the possible programmatic solutions is to create following proxy:

    IWebProxy proxy=HttpWebRequest.GetSystemWebProxy();  
    proxy.Credentials = CredentialCache.DefaultCredentials;  
    

    and then assign this to any object that make the network call and accept a proxy,e.g:

    WebClient client = new WebClient();
    client.proxy= proxy;

提交回复
热议问题