Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
This is a simple test, posting from a network that uses an authenticated proxy to any webserver. I get the following exception:
POST Request to http://ios.jackson.org:9000
Error: System.Net.WebException: Operation is not supported. ---> System.NotSupportedException: Operation is not supported.
at MonoTouch.CoreFoundation.CFNetwork+CFWebProxy.get_Credentials () [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.CheckAuthorization (System.Net.WebResponse response, HttpStatusCode code) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.CheckFinalStatus (System.Net.WebAsyncResult result) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.SetResponseData (System.Net.WebConnectionData data) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
at ProxyConnectionTest.ProxyConnectionTestViewController.RunPostTest2 () [0x00000] in <filename
It might be hard to replicate this issue, but if you look at the CFNetwork source and the HttpWebRequest source, its pretty obvious what is happening. HttpWebRequest tries to get the underlying credentials, but CFWebProxy throws a NotSupportedException.
Just updating this a little. Its even easier to see the problem without needing to setup an authenticated proxy:
var wr = (HttpWebRequest) WebRequest.Create (url);
wr.Proxy.Credentials = new NetworkCredential ("i", "love", "bananas");
will throw a NotSupportedException
yup, removing the NotSupportedException is easy. Just need to test that it's enough to make the proxy authentication works as expected.
So we could use *provided* NetworkCredential (like comment #1) but we cannot use the one kept in the iOS device configuration - since the password is not available  (but we can retrieve the username).
The password to be used when contacting the proxy. This key is only present if the password can be determined from the information passed in. (External credential stores such as the keychain are not consulted.)
Maybe it's marked as shared in the keychain ? but I can see how iOS itself could work without this being the case...
I have no luck with finding the password with keychain (it was a long shot) so, for the moment, I'll ensure developers can provide their own NetworkCredential and expose a few more things (like the NSDictionary that includes more than what's documented).
The (removal of) NotSupportedException and exposing the NSDictionary is now inside maccore
I still have a few crazy ideas to try... but the only one I'm sure would work if to ask (and cache) the proxy password in the application and provide it (with code) as the NetworkCredentials.
This bug was targeted for a past milestone, moving to the next non-hotfix active milestone.
There's not good solution for HttpWebRequest.
However System.Net.Http.HttpClient has a CFNetwork based backend that use Apple API (and would use the OS proxy, including any password).