62,072
社区成员
发帖
与我相关
我的任务
分享
fetch("http://localhost:58513/api/decheng/", {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: { "LogId": 3, "UserName": "test" },
})
HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];
HttpRequestBase request = context.Request;
var id= request.Form["id"];
这种形式.. 虽然你可以获取所有的form . 自己进行转换.. 但是还是 比较麻烦的.
而且这种形式 key还不能重复..
所以你就约束前台调用 只能postjson这种方式就行了.. 目前我还没有太好的解决方案.. 因为是自己不想写太多的代码..