Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/340.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.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代码(使Google API C示例工作)_C#_.net_Proxy - Fatal编程技术网

C# 允许代理访问的C代码(使Google API C示例工作)

C# 允许代理访问的C代码(使Google API C示例工作),c#,.net,proxy,C#,.net,Proxy,是否有人能够帮助理解如何让这个C#示例通过我的代理服务器工作。我注意到在中有一个代码示例,它提供了一些指导,但是我在如何将其应用于DocListExporter示例方面遇到了问题。换言之: 如何在此处应用代码概念(使用代理): 从示例中选择以下代码: GoogleClientLogin loginDialog = new GoogleClientLogin(new DocumentsService("GoogleDocumentsSample"), "youremailh.

是否有人能够帮助理解如何让这个C#示例通过我的代理服务器工作。我注意到在中有一个代码示例,它提供了一些指导,但是我在如何将其应用于DocListExporter示例方面遇到了问题。换言之:

如何在此处应用代码概念(使用代理):

从示例中选择以下代码:

           GoogleClientLogin loginDialog = new GoogleClientLogin(new DocumentsService("GoogleDocumentsSample"), "youremailh...@gmail.com");
            if (loginDialog.ShowDialog() == DialogResult.OK)
            {
                RequestSettings settings = new RequestSettings("GoogleDocumentsSample", loginDialog.Credentials);
                settings.AutoPaging = true;
                settings.PageSize = 100;
                if (settings != null)
                {
                    this.request = new DocumentsRequest(settings);
                    this.Text = "Successfully logged in";

                    Feed<Document> feed = this.request.GetEverything();
                    // this takes care of paging the results in
                    foreach (Document entry in feed.Entries)
                    {
                        all.Add(entry);
                    }
GoogleClientLogin loginDialog=新的GoogleClientLogin(新文档服务(“GoogleDocumentsSample”),“youremailh…@gmail.com”);
if(loginDialog.ShowDialog()==DialogResult.OK)
{
RequestSettings设置=新的RequestSettings(“GoogleDocumentsSample”,loginDialog.Credentials);
settings.autopage=true;
settings.PageSize=100;
如果(设置!=null)
{
this.request=新文档请求(设置);
this.Text=“成功登录”;
Feed=this.request.GetEverything();
//这负责在中分页结果
foreach(feed.Entries中的文档条目)
{
全部。添加(条目);
}
另外,如果您知道如何包含实际代理用户名/密码的语法,那也很酷


谢谢

您是否尝试在app.config文件中设置代理

类似这样的事情-

<system.net>
  <defaultProxy enabled="true" useDefaultCredentials="true">
    <proxy/>
    <bypasslist/>
    <module/>
  </defaultProxy>
</system.net>

no-因此,感谢您强调此方法-如果它有效,这似乎是一种更好的方法否?也就是说,您不必担心如何通过编程实现以使用.net HTTP类的方式将网格划分到Google客户端库中的结果。使用此去极化方法有任何负面影响吗?W如果程序运行在笔记本电脑上,有时可能在代理服务器后面,但不总是在代理服务器后面,那么在没有代理和有代理的情况下交换会更困难吗?谢谢
<system.net>
  <defaultProxy enabled="true" useDefaultCredentials="true">
    <proxy/>
    <bypasslist/>
    <module/>
  </defaultProxy>
</system.net>