Ok this is driving me nuts. My client is on MVC 2 (yes I know) and wants a few more actions added to their existing application.
If I put in the URL of:
http://10.211.55.3/Templates/
it works as expected and comes up with the default action. However if I put in:
http://10.211.55.3/Templates/GetTemplateDetails/1
I get this error:
The parameters dictionary contains a null entry for parameter 'TemplateID' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult GetTemplateDetails(Int32)'. To make a parameter optional its type should be either a reference type or a Nullable type.
Parameter name: parameters
As far as I can tell, I'm supplying the correct route pattern and still it doesn't seem to work. Looking at their Global.asax they have what one would expect:
routes.AddCombresRoute("Combres Route");
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("favicon.ico");
routes.MapRoute(
"Default", // Route name
{controller}/{action}/{id}", // URL with parameters
new {controller = "Home", action = "Index", id = 0} // Parameter defaults
);
routes.MapRoute(
"MarketingRoute",
"Marketing/{action}/{routingAction}/{token}",
new
{
controller = "Marketing",
action = "Route",
routingAction = string.Empty,
token = string.Empty
});
..and here's the test action on the controller which doesn't work....
public ActionResult Index()
{
return View();
}
[AcceptVerbs(HttpVerbs.Get)]
[ActionName("GetTemplateDetails")]
public ActionResult GetTemplateDetails(int TemplateID)
{
return View();
}
Really hoping a fresh pair of eyes can help see what I'm obviously overlooking here.