Hi Brad,

This could just be a bug in MonoTouch. I'll try to look into this as soon as I 
can. You've submitted a bug report to bug ills already, right? (Pretty sure I 
saw one recently filed on this)

Jeff

Sent from my iPhone

On Nov 26, 2012, at 2:25 AM, Brad Moore <[email protected]> wrote:

> Hey
> Trying to load some data off my server (xml data). I normally just use 
> HttpWebRequest as I can set the utomaticDecompression to 
> DecompressionMethods.GZip | DecompressionMethods.Deflate in order to use gzip 
> compression of my data automatically.
> 
> Recently a client has emailed me saying that it does not work from within his 
> school. Sent out another copy of the app to him via TestFlightApp to get more 
> debugging info from him and the app responds with a 407 auth error. Since 
> then I have set up a proxy on my computer which I redirect my iPhone traffic 
> through to test on.
> 
> My original setup was like so,
> 
> HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_url);
> request.CachePolicy = new 
> HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
> request.Proxy = null;
> request.AutomaticDecompression = DecompressionMethods.GZip | 
> DecompressionMethods.Deflate;
> WebResponse response = request.GetResponse();
> 
> and then so on from there.
> 
> I'd set Proxy to null because in most cases the user would not be behind a 
> proxy and this cut off 1-2 seconds of proxy resolving. There is code later to 
> catch this and then re-create the HttpWebRequest but by not nulling the 
> proxy, which I thought would be default proxy. Apparently not so...
> 
> I tried to then get the default proxy settings of the device.
> 
> CFProxySettings proxy0 = CFNetwork.GetSystemProxySettings();
> IWebProxy proxy1 = WebRequest.GetSystemWebProxy();
> IWebProxy proxy2 = HttpWebRequest.DefaultWebProxy;
> IWebProxy proxy3 = HttpWebRequest.GetSystemWebProxy();
> IWebProxy proxy4 = CFNetwork.GetDefaultProxy();
> 
> proxy1 - proxy4 have null for the credentials. proxy0 contains proxy 
> information which I need such as proxy url, port, username, but no password...
> 
> I manually made a WebProxy with my credentials
> 
> WebProxy webProxy = new WebProxy(proxy0.HTTPProxy, proxy0.HTTPPort);
> webProxy.Credentials = new NetworkCredential("user", "pass");
> request.Proxy = webProxy;
> 
> and this works.
> Falling short of requesting username and password for the proxy on a 407 
> error I am not sure what to do...
> WebClient downloads do not work, but UIWebView and MKMapView does auto-auth 
> itself. 
> 
> Any ideas what I am missing?
> 
> - Brad
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to