I have an existing asp.net mvc 4 solution. It has several controllers/models/views in separate folders and all work fine
with both GET and POST controller methods. I have added a new folder and added its own controllers/models/views.
When I call the GET controller method, from the view it works fine. But the POST controller method
throws
HTTP Error 405.0 - Method not allowed. The page you are looking for cannot be displayed because an
invalid method (HHTP verb) is being used.
The following is my view and controller
<div id="usercreds" class="items">
@using (Html.BeginForm("SaveCustomer", "NewCustomer"))
{
//form control code here
}
[HttpPost]
public ActionResult SaveCustomer(NewCustomerModel newCustomer)
{
//more code here
}
I added FormMethod.Post in the Html.BeginForm
method and added modules="IsapiModule"
in web.config file
I still get the same error.
Copyright Notice:Content Author:「Massey」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30770331/http-error-405-0-method-not-allowed-error-in-asp-net-mvc-4-post-method