How do I determine (elegantly) if proxy authentication is required in C# winforms app -


My use case is, I want to call a webservice and if I am behind a proxy server that is authentication I just want to use default credentials ...

  WebRequest.DefaultWebProxy.Credentials = Credential cache. Default credentials; Otherwise, I will just call, instead of handling the exception, instead of trying to call, it would be great to determine whether auth needs to be front.  

Thoughts?

System.Net.WebProxy is UseDefaultCredentials There is a property called that may be be what you want (but I have to accept a little ignorance here). There is a link to the related document.


Comments