.net 发送GET请求和获取无法发送动词类型的内容正文

.net 发送GET请求和获取无法发送动词类型的内容正文,.net,get,webrequest,.net,Get,Webrequest,我正在尝试发送一个GET请求,如下所示,但我继续在控制台上获取以下错误: Test_API_Access.Exception:Cannot send a content-body with this verb-type. System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type. at System.Net.HttpWebRequest.CheckProtocol(Boolea

我正在尝试发送一个GET请求,如下所示,但我继续在控制台上获取以下错误:

Test_API_Access.Exception:Cannot send a content-body with this verb-type.
System.Net.ProtocolViolationException: Cannot send a content-body with this verb-type.
   at System.Net.HttpWebRequest.CheckProtocol(Boolean onRequestStream)
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at Test_API_Access.Program.Test_API_Access() in c:\Users\<username>\Documents\Visual Studio 2013\Projects\Test_API_Access\Test_API_Access\Program.cs:line 43

我已经找到了解决方案,以防任何人在搜索时遇到此错误,基本上是为了获得需要使用http POST的请求流:

webRequest.Method = "GET";
需要

webRequest.Method = "POST";
我在这里找到了答案:

添加(“标题”);
string response=web.DownloadString(“您的Uri | | URL”)

仅当请求方法不同于
Get
时才允许请求内容:

if (request.Method != HttpMethod.Get)
{
    request.Content = ...;
}

你能不能展开并解释一下,而不仅仅是张贴代码?
WebClient web = New WebCLient();
if (request.Method != HttpMethod.Get)
{
    request.Content = ...;
}