Reputation: 23766
I have a method in a controller:
public class WorkController : Controller
{
public JsonResult GetWorks()
{
...
return Json(outDto);
}
}
When I make a get request by Work/GetWorks, the method runs. When I do the same with a POST request, Application_BeginRequest runs, but the method does not. How can I know the reason to this?
Upvotes: 1
Views: 171
Reputation: 532465
Can you show the code that generates the post action (i.e., BeginForm())? Is the view generating the form rendered from the same controller? My suspicion is that it may be mapped onto a different controller. You should check that the URL is what you expect.
Upvotes: 0
Reputation: 5063
Try giving your Method the following attribute:
[AcceptVerbs(HttpVerbs.Post)]
Upvotes: 2