I am getting an error on a web site deployed on client machines. At first I thought it was caused by Windows authentication and multiple error providers as per my answer to the question here. But I have added Elmah to do logging on the client and am noticing a pattern....
The controller signature is:
public ActionResult Class(int subjectId, int classGroupId)
The request that is failing is listed in the elmah log:
HTTP_REFERER - https://someUrl.com/Results/Class/4372/16202
however the path info only has one parameter.
PATH_INFO - /Results/Class/4372/
The error message is
System.ArgumentException The parameters dictionary contains a null entry for parameter 'subjectId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Class(Int32, Int32)' in 'MyNamespace.Controllers.ResultsController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters
So somewhere along the line I am losing a parameter. Curious that the error message says the first parameter is missing and not the second.
I have a route set up for this action:
routes.MapRoute(
"ClassResults", // Route name
"{controller}/{action}/{subjectId}/{classGroupId}", // URL with parameters
new { controller = "Results", action = "Class" } // Parameter defaults
);
How can I debug this error, what should I be looking at to determine what the issue is?