我正在寻找如何在ASP.Net Core中将参数从Ajax请求传递到Web API控制器的方式,如经典ASP中的query string
。 我在下面尝试过,但没有奏效。如何将参数从Ajax请求传递到Web API控制器?
查看:
"ajax":
{
"url": "/api/APIDirectory/[email protected]"
"type": "POST",
"dataType": "JSON"
},
控制器:
[HttpPost]
public IActionResult GetDirectoryInfo(string reqPath)
{
string requestPath = reqPath;
// some code here..
}
任何人都可以请告知可在asp.net核心Web API来实现这一目标的途径?
确保'@ ViewBag.Title'不为空。 – Xyroid