我正在学习ASP.Net MVC 5的基础知识。并且我想使用Advanced rest Client
向SecurityController
中的一个控制器动作发出POST请求。但我无法这样做。请指导我。如何使用Advanced Rest Client进行POST请求
下面是我的尝试:
[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; }
}
现在什么是我需要在我的高级REST客户端进行更改?
步骤1.设置要求下拉菜单POST
第2步:在原始有效载荷部分下面我补充明确:
one = 2, two = 3, three = 4 seperated by comma.
我不知道这是正确的方式。
步骤3.我需要把一些内容类型或任何其他配置。目前,我的错误为Resource not found
。
这里是截图:
有效负载不是JSON,应该是JSON:'{“one”:2,“two”: 3,“three”:4}' – Gusman
为什么你在URL中添加'/ security'?控制器是“SecurityController”吗? –
我有我的securitycontroller – Unbreakable