我正在提交一个表单,将三个值传递给控制器,这是电子邮件,全名和id字段。Asp.net核心传递多个参数+ web api
@using (Html.BeginForm("SubmitResult", "TestAPI", FormMethod.Post, new { id = "postEmailForm" }))
{
<div id="details-container">
<input type="text" name="email" />
<input type="text" name="fullName" />
<input type="text" name="studentId" />
<button type="submit" id="send">Send</button>
</div>
}
控制器:
[HttpPost("SubmitResult/{email}/{fullName}/{studentId}")]
[Authorize(Roles = "Admin, Shop")]
public IActionResult SubmitResult(string email, string fullName, long? studentId)
{
}
然而,当我点击提交按钮,它会抛出在控制台中的错误消息。
选项https://localhost:50138/TestAPI/SubmitResult net :: ERR_SSL_PROTOCOL_ERROR。
头:
请求URL:https://localhost:50138/TestAPI/SubmitResult
引荐政策:无引用,当降级
如何正确装饰属性控制器,所以我可以使用Postman传递多个参数来测试API?
我期待着像下面这样的测试工作。
http://localhost:50138/api/TestAPI/SubmitResult/[email protected]/MikeShawn/2
那么那个ASP.NET Core应用程序还是ASP.NET Web Api?你的标签很混乱,因为它不一样。 –
对不起编辑。这是asp.net核心应用程序 – pavilion