VahidN / DNTIdentity

A highly customized sample of the ASP.NET Core Identity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sending Json instead of Form Data in DynamicPermission

paradisehuman opened this issue · comments

سلام این کد اجرا میشه و مشکلی ندارم.

 [HttpPost]
        [Authorize(Policy = ConstantPolicies.DynamicPermission)]
        [ActionName("Test")]
        public ActionResult Test([FromForm] string model)
        {
            return Json("ok");
        }

چطور میشه به جای ارسال فرم دیتا، جیسن ارسال کرد ؟

 [HttpPost]
        [Authorize(Policy = ConstantPolicies.DynamicPermission)]
        [ActionName("Test")]
        public ActionResult Test([FromBody] string model)
        {
            return Json("ok");
        }

وقتی جیسن ارسال میکنم این ارور رو بهم میده :

An unhandled exception occurred while processing the request
InvalidOperationException: Incorrect Content-Type: application/json
Microsoft.AspNetCore.Http.Features.FormFeature.ReadForm()

commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related problems.