WebProxy

Does anyone have sample code using HttpWebRequest with a proxy? My code works fine on network with no proxy, but when i move to a proxied network it fails. I tried this:

               
var proxy = new System.Net.WebProxy("my.proxy.server", true);
request.Proxy = (GHIElectronics.NETMF.Net.IWebProxy) proxy;

This code gets an invalid cast exception. Thoughts? Examples?

Thanks!

I am not sure if this is supported on little devices like panda (USBizi) but should be fine on cobra (EMX).

No problem. I just created my own version of WebProxy. I cheated a little, but it works.


public class MyWebProxy : GHIElectronics.NETMF.Net.IWebProxy
    {
        #region IWebProxy Members

        public GHIElectronics.NETMF.Net.Uri GetProxy(GHIElectronics.NETMF.Net.Uri destination)
        {
            return new Uri("http://my.proxy.server.com");
        }

        public bool IsBypassed(GHIElectronics.NETMF.Net.Uri host)
        {
            return false;
        }

        #endregion
    }