I’ve got an Asp.Net mvc web app that has a controller action to handle a post with an int as a parameter. I’ve set a breakpoint in the action and it is never getting hit. Here is the controller action setup:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult AddTestNumber(int number)
{
And here is the jquery that calls the action:
$.post("/testController/AddTestNumber/852852");
I’ve tested it with no parameters and it hit the breakpoint. I havent changed any routing, so thats set to default.
This seems like it should be very simple fix that I’m overlooking
A couple of things to try:
Your URL doesn’t need to contain ‘Controller’.
i.e.
If you want the parameter to be in the URL, rather than in the query-string, and you are using default routing, then I believe the parameter needs to named ‘id’.
i.e.
Otherwise, you need to pass it via the query-string.
i.e.
or add custom routing rules.
I hope one of those helps you out.