I have the following controller method:
public ActionResult GetResults(string viewToReturn, int resultsPerPage,
string classification = null, string sessionId = null, int? lastId= null)
{
...
}
Calling the method above via the following url:
http://localhost:63455/Home/GetResults?viewToReturn=grid&resultsPerPage=30
results in an exception thrown with this message:
A public action method 'GetResults' was not found on controller 'MyWebSite.Controllers.HomeController'.
and here is the RegisterRoutes:
......
routes.MapRoute("Home", "home/{action}/{*qualifier}",
new { controller = "Home", action = "Index", qualifier = UrlParameter.Optional });
......
routes.MapRoute("SearchTitle", "{*path}",
new { controller = "Home", action = "SearchTitle", path = UrlParameter.Optional });
Why am I getting this error and how do I fix it? Thanks!
I had the [HttpPost] attribute on the method. I could swear that I removed it earlier, but somehow after I took a break and came back, I saw it. After removing it, everything now works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With