I am trying to submit an HTTP request but I am behind a proxy. I am trying to auto configure the proxy as you see in the code below but I get a 404 not found as a response. I am guessing something about the proxy configuration is not correct. Any ideas?
WebProxy proxy = new WebProxy("http://companyproxy.com/proxy.pac");
proxy.UseDefaultCredentials = true;
WebRequest request = WebRequest.Create
("http://weather.noaa.gov/pub/data/observations/metar/stations/LGSO.TXT");
request.Proxy = proxy;
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse response = request.GetResponse();
response.Close();
I have tried using default credentials for the proxy as well as my own network credentials but i get the same error.
EDIT: Tried this approach having the IE proxy configured in Settings > Connections > LAN
WebRequest request = WebRequest.Create
("http://weather.noaa.gov/pub/data/observations/metar/stations/LGSO.TXT");
request.Proxy = WebRequest.GetSystemWebProxy();
request.Credentials = CredentialCache.DefaultCredentials; ;
WebResponse response = request.GetResponse();
Now I get proxy (407) Proxy Authentication Required.