【问题标题】:what is webclient & uses of webclient in .net什么是 webclient 以及 .net 中 webclient 的用途
【发布时间】:2010-12-13 10:45:29
【问题描述】:

什么是 webclient 以及 webclient 的用途?

【问题讨论】:

  • 这读起来像是考试或面试问题。
  • 将标签更改为 C# ,除非您更具体,否则问题与 asp.net mcv 无关
  • 这个问题的答案真的很容易通过谷歌搜索找到。谷歌搜索时的第一击 webclient c# 状态:Provides common methods for sending data to and receiving data from a resource identified by a URI.

标签: .net webclient


【解决方案1】:

WebClient 是一个允许您从 .NET 应用程序向远程地址发送 HTTP 请求的类。这是控制台应用程序中的一个示例:

class Program
{
    static void Main()
    {
        using (var client = new WebClient())
        {
            string result = client.DownloadString("http://www.google.com");
            Console.WriteLine(result);
        }
    }
}

【讨论】:

    【解决方案2】:

    来自 MSDN

    提供向由 URI 标识的资源发送数据和从其接收数据的常用方法。

    【讨论】:

      猜你喜欢
      • 2017-12-31
      • 1970-01-01
      • 2011-04-15
      • 1970-01-01
      • 2022-01-31
      • 2010-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多