private bool GB_Login(string username, string password)
{
string url = "https://www.google.com/accounts/ServiceLoginAuth";
HttpWebRequest req;
req = (HttpWebRequest)HttpWebRequest.Create(url);
req.AllowAutoRedirect = true;
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
req.CookieContainer = CookieCont;
req.Accept = "*";
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
StringBuilder postData = new StringBuilder();
postData.AppendFormat("{0}={1}&", "service", "bookmarks");
postData.AppendFormat("{0}={1}&", "nui", "1");
postData.AppendFormat("{0}={1}&", "hl", "en");
postData.AppendFormat("{0}={1}&", "Email", username);
postData.AppendFormat("{0}={1}&", "Passwd", password);
postData.AppendFormat("{0}={1}&", "PersistentCookie", "yes");
postData.AppendFormat("{0}={1}&", "rmShown", "1");
postData.AppendFormat("{0}={1}&", "continue",
"http://www.google.com/bookmarks/lookup%3Foutput%3Dxml%26num%3D10000");
byte[] postDataBytes = Encoding.UTF8.GetBytes(postData.ToString());
req.ContentLength = postDataBytes.Length;
Stream postDataStream = req.GetRequestStream();
postDataStream.Write(postDataBytes, 0, postDataBytes.Length);
postDataStream.Close();
HttpWebResponse resp;
resp = (HttpWebResponse)req.GetResponse();
Stream rcvStream = resp.GetResponseStream();
byte[] respBytes = new byte[8192];
int byteCount;
StringBuilder wText = new StringBuilder();
do
{
byteCount = rcvStream.Read(respBytes, 0, 8192);
wText.Append(Encoding.ASCII.GetString(respBytes));
}
while (byteCount > 0);
resp.Close();
rcvStream.Close();
return true;
}