1

Hi i am creating some web requests through my controller in my asp.net MVC apps.To authenticate proxy i am using

System.Net.WebRequest.DefaultWebProxy.Credentials =  System.Net.CredentialCache.DefaultNetworkCredentials;

This works fine while making web request to external servers like e.g: http://www.google.com or whatever

but when i make request to my localhost it says proxy error and gives a error code 502. What could be the possible cause of this error? Any help really appreciated.

2
  • Is this a network-level proxy or a local machine proxy? Requests to localhost probably bypass the proxy altogether. Commented Mar 4, 2013 at 22:38
  • this is a network-level proxy Commented Mar 4, 2013 at 22:45

1 Answer 1

1

It was the issue with IIS which actually doesn't read the host file so have to manually assign the proxy server and the bypass list to the web.config file. Good resource http://msdn.microsoft.com/en-us/library/31465c77.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.