找不到类型或命名空间“HTTPGet”

时间:2017-08-31 12:49:16

标签: c# winforms

我正在使用Visual Studio在C#中编码。 这是我的代码部分,我遇到了一些问题:

int group = (context.Ads.Where(a => a.RegionId == 100).Max(t => (int?)t.Group)) ?? 0) + 1;

这就是我所包含的内容:

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”。

我该怎么办?

1 个答案:

答案 0 :(得分:0)

我想你想通过GET创建http请求。你还需要类似于HttpWebRequest的东西:

C# how to properly make a http web GET request

或者您可能会混淆属性Understanding [HttpPost], [HttpGet] and Complex Actionmethod parameters in MVC