Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.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
Http post 如何在Fiddler中创建Post请求_Http Post_Fiddler - Fatal编程技术网

Http post 如何在Fiddler中创建Post请求

Http post 如何在Fiddler中创建Post请求,http-post,fiddler,Http Post,Fiddler,尝试向我的C#API发送Fiddler Post请求,如下所示(这是我使用VS2012的开发环境)。但是,我的请求对象在C#中是null。在composer选项卡的已解析选项卡中。我的帖子URL:http://localhost:33218/api/drm 用户代理:Fiddler/4.4.9.2(.NET 4.0.30319.34209;WinNT 6.1.7601 SP1;en-US;4xAMD64) Pragma:没有缓存 接受语言:en US 主机:本地主机:33218 接受编码:gzi

尝试向我的C#API发送Fiddler Post请求,如下所示(这是我使用VS2012的开发环境)。但是,我的请求对象在C#中是
null
。在composer选项卡的已解析选项卡中。我的帖子URL:
http://localhost:33218/api/drm

用户代理:Fiddler/4.4.9.2(.NET 4.0.30319.34209;WinNT 6.1.7601 SP1;en-US;4xAMD64)
Pragma:没有缓存
接受语言:en US
主机:本地主机:33218
接受编码:gzip,deflate
连接:关闭
内容长度:80
请求机构:

&sid=f7f026d60bb8b51&riskMeasureName=RMTest
下面是C#API方法:

//POST api/drm
公共httpresponsemessagepost([FromBody]JObject-drmObject)
{
字符串sid=drmObject.GetValue(“sid”).ToString();
字符串riskMeasCategory=drmObject.GetValue(“riskMeasureName”).ToString();
string response=DynAggrClientAPI.insertDRMCategory(sid,riskMeasCategory);
var httpResp=Request.CreateResponse(HttpStatusCode.OK);
httpResp.Content=newstringcontent(响应,Encoding.UTF8,“application/json”);
返回httpResp;
}
我可以用C#
Post()
方法进行调试,但是
drmObject
null


非常感谢您的建议。

您没有发送内容类型,因此MVC无法告诉您如何解释数据

您的数据似乎类似于表单帖子,因此请添加标题:

Content-Type: application/x-www-form-urlencoded

哇,我一定把它拿走了。添加
内容类型
,这当然奏效了@编解码器