我正在学习ASP.Net MVC 5的基础知识。我想对SecurityController
使用中出现的控制器动作之一发出POST请求Advanced rest Client
。但是我不能这样做。请指导我。
以下是我的尝试:
[HttpPost]
public ActionResult Hello(SampleMV viewModel)
{
return Content("Hello");
}
public class SampleMV
{
public int one { get; set; }
public int two { get; set; }
public int? three { get; set; }
}
现在,我需要在Advanced Rest Client中进行哪些更改?
步骤1.将请求下拉列表设置为 POST
步骤2.在原始有效负载部分中,我在下面明确添加:
one = 2, two = 3, three = 4 seperated by comma.
我不确定这是否正确。
步骤3.我是否需要放入某些内容类型或任何其他配置。目前,我收到的错误Resource not found
。
这是屏幕截图:
您的有效负载格式不正确,JSON中的对象定义应为 { "one":2, "two":3, "three":4 }
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句