How to use Windows login credentials for proxy authentication using C #

Is it possible to use login credentials for proxy authentication using C #.

I have a facebook application that calls facebook methods. During every facebook call, the error "407: proxy authentication is required" occurs

The following code will allow the user to set the proxy: -

WebProxy oWebProxy = new System.Net.WebProxy(ProxyServer, ProxyPort);       
oWebProxy.Credentials = new NetworkCredential(ProxyUser,ProxyPassword,ProxyDomain);
oserv.Proxy = oWebProxy; 
oserv.Credentials = new NetworkCredential(theusername, thepassword); 

But is there any other way to do the same without hardcoding credentials to enter my company.

+3
source share
2 answers

You can use:

oWebProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;

- , : http://support.microsoft.com/kb/813834

+5

WebProxy ( -) , .

WebProxy oWebProxy = new System.Net.WebProxy();

-.

0

Source: https://habr.com/ru/post/1764482/


All Articles