Good afternoon my dear, I need to make a request for an api that is in a domain outside the local network, I do this through a webrequest that was created this way:
WebRequest myWebRequest = WebRequest.Create("urldestino");
However, the network has a proxy, which blocked my requests stating that proxy authentication was required. To test the operation, I was able to perform the request by setting the proxy manually as follows:
WebProxy myProxy = new WebProxy();
myProxy = (WebProxy)WebProxy.GetDefaultProxy();
myProxy.Credentials = new NetworkCredential("meuusuario", "minhasenha", "meudominio");
myWebRequest.Proxy = myProxy;
Detail: After running "myProxy = (WebProxy)WebProxy.GetDefaultProxy();"
myProxy.Credentials got null, so I set it manually.
In this way, the request passes through the proxy, however, I was directed to get the proxy session already authenticated by windows, in the same way that browsers and postman does, in postman for example I make the request without the need of inform the proxy data and it does not return me a proxy authentication is required.
Is there any way I can get the authenticated proxy session, without having to manually enter the user's registration and password?
Thank you very much in advance.