C# 使用http请求下载google位置历史记录

C# 使用http请求下载google位置历史记录,c#,geolocation,httprequest,google-login,C#,Geolocation,Httprequest,Google Login,我正试图编写一个c代码,从中下载kml文件 我编写了下面的代码,但返回的http响应将我带到登录页面,即使 HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://maps.google.com/locationhistory/b/0/kml?startTime=1373666400000&endTime=1373752800000"); request.Credential

我正试图编写一个c代码,从中下载kml文件

我编写了下面的代码,但返回的http响应将我带到登录页面,即使

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://maps.google.com/locationhistory/b/0/kml?startTime=1373666400000&endTime=1373752800000");

        request.Credentials = new NetworkCredential("username", "password");
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        // Get the stream associated with the response.
        Stream receiveStream = response.GetResponseStream();

        // Pipes the stream to a higher level stream reader with the required encoding format. 
        StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);

        using (StreamWriter outfile = new StreamWriter(@"temp.kml"))
        {
            outfile.Write(readStream.ReadToEnd());
        }

        response.Close();
        readStream.Close();
我尝试传递用户凭据。 我已经尝试过这些解决方案: - - 但什么都没用

是否有人知道如何通过谷歌认证,并有经验的谷歌位置历史api

谢谢