Error 407 Proxy Authentication Required .net
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up The remote server returned an error: (407) Proxy Authentication Required up vote 47 down vote favorite 9 I'm getting this error when I call a web service: "The remote server returned an error: (407) Proxy Authentication Required". I get the general idea and I can get the code to work by adding myProxy.Credentials = NetworkCredential("user", "password", "domain"); or by using DefaultCredentials in code. My problem is that the call to the web service works in production without this. It seems like there is a non code solution involving Machine.config, but what is it? At the moment I can't get to the production box's machine.config file to see what that looks like. I tried updating my machine.config as follows, but I still get the 407 error.
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is http://stackoverflow.com/questions/2581609/the-remote-server-returned-an-error-407-proxy-authentication-required a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Proxy Basic Authentication in C#: HTTP 407 error up vote 28 down vote favorite 15 I am working with a proxy that requires authentication, i.e., in a browser if I try to http://stackoverflow.com/questions/9603093/proxy-basic-authentication-in-c-http-407-error open a page it will immediately ask for credentials. I supplied same credentials in my program but it fails with HTTP 407 error. Here is my code: HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); IWebProxy proxy = WebRequest.GetSystemWebProxy(); CredentialCache cc = new CredentialCache(); NetworkCredential nc = new NetworkCredential(); nc.UserName = "userName"; nc.Password = "password"; nc.Domain = "mydomain"; cc.Add("http://20.154.23.100", 8888, "Basic", nc); proxy.Credentials = cc; //proxy.Credentials = System.Net.CredentialCache.DefaultCredentials; request.Proxy = proxy; request.Proxy.Credentials = cc; request.Credentials = cc; request.PreAuthenticate = true; I have tried every possible thing but seem like I am missing something. Is it something like, I have to make two requests? First with out credentials and once I hear back from server about need for credentials, make same request with credentials? c# proxy httpwebrequest basic-authentication http-status-code-407 share|improve this question edited Oct 26 '15 at 8:26 Nicolas Raoul 24.8k33119222 asked Mar 7 '12 at 14:16 rplusg 1,38142143 What authentication scheme does your proxy server require? Basic? NTLM?
can track if any of this is useful to you! Thanks! HttpWebRequest WebExcepton: The remote server returned an error: (407) Proxy Authentication Required. https://blogs.msdn.microsoft.com/jpsanders/2009/03/24/httpwebrequest-webexcepton-the-remote-server-returned-an-error-407-proxy-authentication-required/ ★★★★★★★★★★★★★★★ Jeff SandersMarch 24, 20097 0 0 0 Problem System.Net Tracing (see My Favorite System.Net Tracing File) revealed that we are getting the 407 error and the .NET framework is not retrying the request with Credentials. System.Net Error: 0 : [4811] Exception in the HttpWebRequest#33574938:: - The remote server returned an error: (407) Proxy Authentication Required. We can see in a Fiddler2trace that Internet Explorer does error 407 submit the 407 credentials of the currently logged on user, but the HttpWebRequest does not even try. We also see that for HTTP traffic there is no 407 in either request. Only HTTPS traffic was requiring credentials for the proxy. Resolution By default the Proxy object does not supply the credentials of the Currently Logged on User. You can fix this by: 1.Supply the credentials of the error 407 proxy Currently Logged on User to the Proxy object similar to this: Copy Code: