Hi,
I try to access web services behind a proxy. Until now, I used unitywebrequest but I understood that proxy configuration wasn't handled by them. So I changed my code to use HttpWebRequest as it allows manual proxy configuration.
I wrote a simple code to test this, but I'm still getting timeout.
HttpWebRequest hwr = (HttpWebRequest)WebRequest.Create(ADMIN_URL);
hwr.Method = "HEAD";
hwr.Timeout = 5000;
WebProxy proxy = new WebProxy(PROXY_URL, true);
proxy.Credentials = new NetworkCredential(myLogin, myPassword);
hwr.Proxy = proxy;
try
{
using (HttpWebResponse response = (HttpWebResponse)hwr.GetResponse())
{
Debug.Log("response: " + response.StatusCode);
}
}
catch (Exception e)
{
Debug.Log("Serveur not reachable: " + e.GetBaseException().Message);
}
If I remove the proxy configuration (and use a connexion without proxy) it works.
If i use the same code in a wpf .NET application (with proxy), it works.
I runned my tests through the Unity editor and with a pc standalone build.
My Unity version is 5.4.1f1
If you have any hint that can helps me... thank you
↧