A public action method '..' was not found on controller '..'
If the executing request is a POST
, then it will try to find a method RandomSponsor
accepting HttpPost
. If this makes sense, you could remove HttpGet
and that should do the trick.
This can also happen if you have many layers of calls that start with a POST (I had an action returning a view returning a partial view calling RenderAction), then the call to RenderAction will still look for a POST method
Very similar to this problem that I had here - How to solve "public action method 'methodActionName' was not found on controller 'controllerNameController'"
And if you want to continue to accept the HTTP GET verb and fix the problem of cascading post request into a get request add this to your method
[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
Keep in mind that [HttpGet] is the same as [AcceptVerbs(HttpVerbs.Get)]
This will happen if the request is a POST
but the controller method is annotated [HttpGet]
. For example, you might issue a POST
that returns a view containing partial views called with @Html.Action
, using controller methods annotated with [HttpGet]
. If the original request is a POST
, all of the controller methods subsequently called will need to support POST
.
To fix it you can use the AcceptVerbs
attribute to specify that your controller method accepts both POST
and GET
:
[AcceptVerbs(HttpVerbs.Post | HttpVerbs.Get)]