Follow

Using WWW with a Proxy

Symptoms 
  • I want to use WWW with a Proxy in players (runtime), but it does not work. (Not WebPlayer)
Cause
If you use WWW with a Proxy in players (runntime, not WebPlayer) it may fail.
 
Resolution
WebPlayer takes the Proxy settings from the browser automatically. Other players (runtime) work differently and cannot use a Proxy. Therefore you can use this workaround with the WebClient and WebProxy classes and still use the Proxy:
string yourURL = "http://yourURL.com";
WebClient client = new WebClient();

WebProxy proxy = new WebProxy("yourproxyserver.com"); // you can use yourproxyserver.com:port
// check proxy.Credentials property and NetworkCredential class if you proxy uses user/password

client.Proxy = proxy;

With this code, you can use WebProxy.Credentials and the NetworkCredential class to set user/password info.

More Information
Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

3 Comments

  • 1
    Avatar
    Mirokia

    My situation is similar to yours. Tell me, my provider (advanced.name/ru) is suitable for solving problems, or needs a specific service provider?

  • 1
    Avatar
    Juan Diego Uran

    Hi Mirokia, you could use any proxy provider, so it should work with your provider.

  • 0
    Avatar
    Bruno Corte

    Doesn't work when building for Windows Holographic.

    I get the error:

    The type or namespace name 'WebClient' does not exist in the namespace 'System.Net' (are you missing an assembly reference?)

    Any other options?

Please sign in to leave a comment.