Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual C#:连接到Google帐户_C#_Connection_Account - Fatal编程技术网

Visual C#:连接到Google帐户

Visual C#:连接到Google帐户,c#,connection,account,C#,Connection,Account,我正在尝试连接我的谷歌帐户,并获得我的博客主页的html代码。我发现需要一个cookies来保持连接,但我不知道怎么做 用户名和密码的邮寄地址为“https://www.google.com/accounts/ClientLogin" 提前谢谢 有一些关于如何做事的好例子。如何从博客中检索帖子。希望有帮助。试试这个 private bool Authorize(out string authCode) { bool result = false; authCode = "";

我正在尝试连接我的谷歌帐户,并获得我的博客主页的html代码。我发现需要一个cookies来保持连接,但我不知道怎么做

用户名和密码的邮寄地址为“https://www.google.com/accounts/ClientLogin"

提前谢谢

有一些关于如何做事的好例子。如何从博客中检索帖子。希望有帮助。

试试这个

private bool Authorize(out string authCode)
{
    bool result = false;
    authCode = "";

    string queryString = String.Format("https://www.google.com/accounts/ClientLogin?accountType=HOSTED_OR_GOOGLE&Email={0}&Passwd={1}&service=cloudprint&source={2}", UserName, Password, Source);
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(queryString);

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    string responseContent = new StreamReader(response.GetResponseStream()).ReadToEnd();

    string[] split = responseContent.Split('\n');
    foreach (string s in split)
    {
        string[] nvsplit = s.Split('=');
        if (nvsplit.Length == 2)
        {
            if (nvsplit[0] == "Auth")
            {
                authCode = nvsplit[1];
                result = true;
            }
        }
    }

    return result;
}

`

emmm结果是SID LSID和AUTH,但我如何才能得到“html代码”?