[MonoTouch] error calling google calendar api using webclient class

Yosi Taguri yosi at taguri.com
Sun Aug 9 04:10:58 EDT 2009


 From a previous thread here - network authenticated is not  
implemented - it should be in this week on the next drop.

On Aug 9, 2009, at 4:15 AM, Mike Bluestein wrote:

> I'm try to authenticate to the google calendar service from  
> monotouch using the method outlined here:
>
> http://code.google.com/apis/calendar/docs/2.0/developers_guide_protocol.html#AuthClientLogin
>
> Using code like this:
>
> 	WebClient wc = new WebClient();
> 	wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
> 		
> 	NameValueCollection nvc = new NameValueCollection();
> 	nvc.Add("Email", "someuser at gmail.com");
> 	nvc.Add("Passwd", "somepassword");
> 	nvc.Add("source", "company1-app1-1");
> 	nvc.Add("service", "cl");
> 			
> 	Uri uri = new Uri("https://www.google.com/accounts/ClientLogin");
> 			
> 	byte[] bytes = wc.UploadValues(uri, "POST", nvc);
> 	string result = Encoding.ASCII.GetString(bytes);
>
> yields this error:
>
> Unhandled Exception: System.Net.WebException: Error: ConnectFailure
>   at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult  
> asyncResult) [0x0004c] in /Users/plasma/src/mcs/class/System/ 
> System.Net/HttpWebRequest.cs:709
>   at System.Net.HttpWebRequest.GetRequestStream () [0x0004c] in / 
> Users/plasma/src/mcs/class/System/System.Net/HttpWebRequest.cs:724
>   at System.Net.WebClient.UploadValuesCore (System.Uri uri,  
> System.String method,  
> System.Collections.Specialized.NameValueCollection data,  
> System.Object userToken) [0x00109] in /Users/plasma/src/mcs/class/ 
> System/System.Net/WebClient.cs:769
>   at System.Net.WebClient.UploadValues (System.Uri address,  
> System.String method,  
> System.Collections.Specialized.NameValueCollection data) [0x00035]  
> in /Users/plasma/src/mcs/class/System/System.Net/WebClient.cs:727
>
> Also, I'm running mtouch with the -nolink option.
>
> To help verify the code is ok, I built and ran it on visual studio  
> 2008/vista as a console app and it worked ok.
>
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monotouch/attachments/20090809/5d99576f/attachment.html 


More information about the MonoTouch mailing list