I used a 3rd party plugin that sends a POST request API controller and getting this error:
"The requested resource does not support http method 'GET'."
.NET Controller
[HttpPost]
public WebApiResponseModel HandleContactForm(ContactFormViewModel model);
JavaScript
$.ajax({
url: "/Api/ContactForm/HandleContactForm/",
type: "POST",
data: object
success: function (result) {
////result here
},
error: function (data) {
//// right data error here
}
});
The controller is using library System.Web.Mvc. I can't edit it to replace to System.Web.Http because it is a third party controller and placed in a dll.
My bad, I already resolved this by adding mail settings in the web.config
<mailSettings>
<smtp from="test@test.com">
<network host="smtp.gmail.com" port="587" userName="testuser" password="testpassword" enableSsl="true" />
</smtp>
</mailSettings>