我正在學習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