If a Gmail user sends an email with an inline image, then the image will be stored on Google's servers, and the email's HTML will include code like this...
<img src="https://mail.google.com/mail/u/0?lot-sof-stuff-here" alt="Yoda.png" width="300" height="300">
If you're logged in to Google, you can visit this link in your browser, and you'll be redirected to the image, whose URL looks like...
https://gm1.ggpht.com/lots-of-stuff-here-too
If you're not logged in, you'll get sent to Google's sign-in page
I want to download the image from my C# code, but have two problems, first I need to get past the Google sign-in, and second I need to handle the redirect.
I tried the following...
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.AllowAutoRedirect = true;
request.Credentials = new NetworkCredential("gmailaddress", "password");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
...but the response object has a ResponseUri for the Google sign-in page, which sounds like it ignored the credentials I passed in.
Anyone any idea how I can do this? Thanks
Update Following the comment by SiKing, I don't think tis is a Gmail issue as such, I think the storage being used here is more general Google storage. The problem is I can't find any Google API for accessing that storage. If anyone knows of any, please point me in the right direction.