I'm using .NET 2.0 to make a simple webservice call. From most machines, I don't need to do anything special. However, one client is on a corporate network that uses a proxy autoconfig script. Just about everything I can find (e.g. http://msdn.microsoft.com/en-us/magazine/cc300743.aspx#S3) tells me that I shouldn't need to do anything. .NET will read the proxy settings from the registry and "just work". Yeah right.
If the client uses their browser to visit the webservice URL first, then my webservice call does work. However, after some period of time the webservice calls stop working with a 407 (Proxy Authentication Required) error.
I've tried explicitly setting the proxy (as suggested by http://stackoverflow.com/questions/284511/get-proxy-configuration-before-accessing-an-external-webservice-net-2-0), but haven't had any luck.
I found this MS knowledgebase article with information on calling WinHttpGetProxyForUrl in WinHTTP.DLL. If I pull the autoconfigurl setting out of the registry and use it in a call to WinHttpGetProxyForUrl, it seems to work, but it just seems wrong to have to go there. Does anyone know the "right way" to get .NET to use the default IE proxy autoconfig script? Thanks.