I'm just working on an existing C# ASP.NET MVC 3/4 application and I am getting an error when trying to call a method.
The call is
@url.Action("Bob", "BobController")
The controller is:
[Authorized]
class BobController ...
{
public ActionResult Bob()
{
// ...
}
}
The error I get is
A public action method 'Bob' was not found on controller MyController
What is happening, the constructor is being fired in the class so I can see the call being made and arriving at the controller, then it jumps to the Application_Error
in global.asax
.
Just wondering, if there is a way of determining what it is looking for (missing permission, incorrect route etc.) so I can see why it is failing?
Regards
You dont need to postfix the controller in the @Url.Action
part with ´controller´ as the framework already takes care of that for you.
It should be enough like the following: @Url.Action("Bob", "Bob")