[mono-android] Unexpected Exception from System.Net.WebClient result

subsembly a.selle at subsembly.com
Fri Jan 13 09:37:52 UTC 2012


Hi,

during further porting I found, that a request sent through the WebClient
sometimes succeeds and sometimes fails. I am not sure whether this is a
device related problem. However, the same code always succeeds on my desktop
PC connect to the same W-LAN.

In order to reproduce you just have to create a new default Android
application and replace the button click event as follows:

			button.Click += delegate
			{
				Android.Util.Log.Info("TADA", "Click");
				System.Net.WebClient aWebClient = new System.Net.WebClient();
				aWebClient.DownloadStringCompleted += (sender, args) =>
				{
					Android.Util.Log.Info("TADA", "DownloadStringCompleted");
					if (args.Error != null)
					{
						Android.Util.Log.Error("TADA", "Error");
					}
				};
				aWebClient.DownloadStringAsync(new Uri(@"http://subsembly.com/"));
			};


Again, I am testing/debugging on a LG Optimus 2X and downloaded the latest
Mono for Android yesterday.

Thanks for any help.


--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/Unexpected-Exception-from-System-Net-WebClient-result-tp5142099p5142150.html
Sent from the Mono for Android mailing list archive at Nabble.com.


More information about the Monodroid mailing list