I am creating a thick client application, which connects to the Picasa
Web Albums  for Windows Mobile 6.1 using C#.Net.

Using the authentication by Google ClientLogin for installed
applications, I am able to download and view the images for any user.
But when I am trying to upload an image to the Web Album I am getting
an exception saying

"This request requires buffering of data for authentication or
redirection to be successful."

As of Now i am just trying to upload an image present on the phone
memory.

Thanks in Advance...

Here is d code..

            StringBuilder sb = new StringBuilder();

            sb.Append("http://picasaweb.google.com/data/feed/api/
user/");
            sb.Append(Username);
            sb.Append("/albumid/");
            sb.Append(AlbumId);

            HttpWebRequest webrequest = (HttpWebRequest)
WebRequest.Create(sb.ToString());
            webrequest.ContentType = "image/jpeg";
            webrequest.Method = "POST";


            sb = new StringBuilder();
            sb.Append("Authorization: GoogleLogin auth=");
            sb.Append(strAuth);
            webrequest.Headers.Add(sb.ToString());

            FileStream fileStream = new FileStream("\\My Documents\\My
Pictures\\Waterfall.jpg",
                                       FileMode.Open,
FileAccess.Read);

            webrequest.ContentLength = fileStream.Length;

            Stream requestStream = webrequest.GetRequestStream();


            // Write out the file contents
            byte[] buffer = new Byte[checked((uint)Math.Min(4096,
                                     (int)fileStream.Length))];
            int bytesRead = 0;
            while ((bytesRead = fileStream.Read(buffer, 0,
buffer.Length)) != 0)
                requestStream.Write(buffer, 0, bytesRead);

            requestStream.Close();

/*Here it throws the exception --GetResponse--
"This request requires buffering of data for authentication or
redirection to be successful."*/

            WebResponse response = webrequest.GetResponse();

            Stream s = response.GetResponseStream();
            StreamReader sr = new StreamReader(s);


            String myResp = sr.ReadToEnd();

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Picasa-Data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to