Public action method not found on controller

I have the following controller method:

public ActionResult GetResults(string viewToReturn, int resultsPerPage, string classification = null, string sessionId = null, int? lastId= null) { ... } 

Call the method above using the following URL:

 http://localhost:63455/Home/GetResults?viewToReturn=grid&resultsPerPage=30 

throws an exception thrown with this message:

The public action method "GetResults" was not found on the controller 'MyWebSite.Controllers.HomeController'.

and here is 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 to fix it? Thank!

+4
c # asp.net-mvc asp.net-mvc-routing controller
May 20 '13 at 20:41
source share
1 answer

I had the [HttpPost] attribute. I could have sworn I removed it earlier, but somehow, after I took a break and came back, I saw it. After removing it, everything works fine.

+6
Nov 11 '13 at 23:51
source share



All Articles