Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.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
C# 安全谷歌认证_C#_Authentication_Google Login - Fatal编程技术网

C# 安全谷歌认证

C# 安全谷歌认证,c#,authentication,google-login,C#,Authentication,Google Login,我需要对谷歌的一项服务进行查询。我读到了这个答案: 从该问题复制并粘贴的代码是: using (var client = new WebClient()) { // TODO: put your real email and password in the request string var response = client.DownloadString("https://www.google.com/accounts/ClientLogin?acco

我需要对谷歌的一项服务进行查询。我读到了这个答案:
从该问题复制并粘贴的代码是:

using (var client = new WebClient())
    {
        // TODO: put your real email and password in the request string
        var response = client.DownloadString("https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&Email=youraccount@gmail.com&Passwd=secret&service=trendspro&source=test-test-v1");
        // The SID is the first line in the response
        var sid = response.Split('\n')[0];
        client.Headers.Add("Cookie", sid);
        byte[] csv = client.DownloadData("http://www.google.com/insights/search/overviewReport?q=test&cmpt=q&content=1&export=2");

        // TODO: do something with the downloaded csv file:
        Console.WriteLine(Encoding.UTF8.GetString(csv));
        File.WriteAllBytes("report.csv", csv);
    }
我想知道在字符串中发送密码是安全的还是可以抓取

如果这是不安全的,应该怎么做呢?

因为它使用(不是普通的HTTP),所以它应该和网络上的大多数其他东西一样安全。一旦建立了底层TLS连接,所有数据(包括URL)都会在加密通道上传输。

这是一种“好消息,坏消息”的情况

好消息:密码不能被窃听者抓取(因为它是通过HTTPS:encrypted发送的)

坏消息:会话cookie可能会被窃听者抓取(因为它是通过HTTP:not encrypted发送的)。正如Firesheep所展示的,让某人访问您的Google会话cookie是危险的,因为它使攻击者能够访问您的电子邮件和存储在Google上的其他内容


如果您可以将
http
URL更改为
https
URL,那么会更安全。

感谢您提供了https链接。我对网络编程或与之相关的任何东西都没有任何线索,但本文用我的OSI模型语言对此进行了解释。