I’m sure I have missed something obvious on this because I’m still a bit of a novice with the MVC2 routing.
I have a website where xyz.com takes you to a request status page(a list of pages) Upon clicking the request, I want to go to xyz.com/RequestDetails/{request id}
My current attempt at a maproute to get this to work is:
routes.MapRoute(
"RequestDetails",
"RequestDetails/(request)",
new { controller = "Home", action = "RequestDetails", request = 0}
);
Intuitively, the above should work but I am getting a 404 error when I attempt a call to xyz.com/RequestDetails/1234
I know the Home controller has an action named RequestDetails:
public ActionResult RequestDetails(int request)
{
//my actions for this request
}
I’m not sure what I’ve done wrong in the above but I’m sure I’ve got something very off :/
Try this:
Note the change from parentheses to curly brackets.