application/x-www-form-urlencoded or multipart/form-data?

前端 未结 6 1545
無奈伤痛
無奈伤痛 2020-11-21 06:35

In HTTP there are two ways to POST data: application/x-www-form-urlencoded and multipart/form-data. I understand that most browsers are only able t

6条回答
  •  猫巷女王i
    2020-11-21 07:21

    If you need to use Content-Type=x-www-urlencoded-form then DO NOT use FormDataCollection as parameter: In asp.net Core 2+ FormDataCollection has no default constructors which is required by Formatters. Use IFormCollection instead:

     public IActionResult Search([FromForm]IFormCollection type)
        {
            return Ok();
        }
    

提交回复
热议问题