I had something similar happen very recently. I was pulling data from a public 
US Government web service that did not require credentials, but I was getting 
the same type of proxy 407 error. My issue turned out to be related to a 
profile that was installed on my phone by another app (not mine). Even though I 
had uninstalled the app and tried to remove the profile previously, it was 
still stuck on there somehow and not visible when looking in the profile 
section.  I found it by pure luck when I re-installed the app in question and 
noticed that it thought the profile was still installed. I forced a re-install 
and then removed it successfully and my 407 errors ended.

Not sure if this is your problem too, but I figured I'd mention it just in case.
Bob


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Jeffrey Stedfast
Sent: Wednesday, November 28, 2012 10:50 AM
To: Brad Moore
Cc: [email protected]
Subject: Re: [MonoTouch] Auto network credentials

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
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to