C# 类型或名称空间";HTTPGet“;找不到
我正在使用Visual Studio用C#编写代码。 这是我在代码中遇到的一些问题:C# 类型或名称空间";HTTPGet“;找不到,c#,winforms,C#,Winforms,我正在使用Visual Studio用C#编写代码。 这是我在代码中遇到的一些问题: HttpGet req = new HttpGet(); req.Request("http://checkip.dyndns.org"); string[] a = req.ResponseBody.Split(':'); string a2 = a[1].Substring(1); string[] a3 = a2.Split('<'); string a4 = a3[0]; label3.Text
HttpGet req = new HttpGet();
req.Request("http://checkip.dyndns.org");
string[] a = req.ResponseBody.Split(':');
string a2 = a[1].Substring(1);
string[] a3 = a2.Split('<');
string a4 = a3[0];
label3.Text = "Public IP Address: " + a4;
我仍然得到这个错误:
找不到类型或命名空间“HTTPGet”
我能做什么?我想您需要通过GET创建http请求。您还需要类似于HttpWebRequest的内容:
或者您可能混淆了属性@KobyDouek名称空间“System.Web”中不存在类型或名称空间名称“Http”(是否缺少程序集引用?)?CLR中没有
HttpGet
类型。HttpGet
不是类HttpGetAttribute
是一个类,但它不用于发出请求。这段代码的用途完全是个谜。我找不到任何具有ResponseBody
属性的框架类型。你确定这不仅仅是某人的草图/伪代码吗?让我理解。您选择了一个无法工作的答案。在这个问题上,你没有选择另一个答案,而是寻求帮助,尽管对原始答案有评论,但你在这里没有提到这个答案?同时,原来的问题有一个公认的答案,而这不是你选择的答案。这就是要点吗?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Management;
using static System.Object;
using System.Net.Http;