Question: Why is the MVC Form giving me an invalid content type from Request? the error says "Incorrect Content-Type".
Login to See the Rest of the Answer
Answer: This error happens when you are trying to post data using a"Get" verb, sometimes this might slip by but sometimes you cannot do this.
In order to resolve this error, verify the following:
1. Make sure that form tags contains action="RightMethodOrFunctionInHere" and method="post"
2. If you are passing in the file make sure that the attribute "enctype" is set as enctype="application/{TheRightEncTypeInHere}". For example
see the code below:
<form action="MyController/ActionName" method="post" enctype="application/x-www-form-urlencoded">
//Your Form Controls come in here
</form>
Leave a comment below if this helped you.
Andrew said:
This is a nagging problem, why is this so hectic to resolve?