Current ActionResult:
[Route("EvaluatorSetup/{evalYear}/{department}")]
public ActionResult RoutedEvaluatorSetup(int evalYear, string department)
{
return EvaluatorSetup((int?)evalYear, department);
}
I would like to use the url:
/EvaluatorSetup/2014/001.3244
where the {department} is a ultimately a string, however, the routing is not picking up {department} as a string.
A. I don't know what type MVC is expecting for "001.3244", or what it is picking it up as.
B. I want to maintain it as a string with optional leading zeros, as in the example.
What am I doing wrong?
Update:
What I mean is, when I put a break in my code at the return line, it never fires.
/EvaluatorSetup/2014/foobar (WORKS!)
/EvaluatorSetup/2014/001.3244 (DOESN'T WORK!)
This leads me to believe that my routing is not correct:
[Route("EvaluatorSetup/{evalYear}/{department}")]
Specifically, it doesn't seem that 001.3244 is a valid string. So my question is how do I correct this:
[Route("EvaluatorSetup/{evalYear}/{department}")]
public ActionResult RoutedEvaluatorSetup(int evalYear, string department)
so that I can enter a uri:
/EvaluatorSetup/2014/001.3244
preferably where the leading zeros are maintained.
I thought about something like this:
[Route("EvaluatorSetup/{evalYear}/{corporation}.{department}")]
however, that is a guess. I don't even know if that is valid.
Additional Update:
the old route in the RouteConfig.cs (which doesn't seem to work anymore) is this:
routes.MapRoute(
"evaluations_evaluatorsetupget",
"evaluations/evaluatorsetup/{evalyear}/{department}",
new { controller = "evaluations", action = "evaluatorsetup", evalyear = @"^(\d{4})$", department = @"^(\d{3}\.\d{4})$" },
new { evalyear = @"^(\d{4})$", department = @"^(\d{3}\.\d{4})$" }
);