Has anyone else had this issue? I have to be doing something wrong.
So I'm setting up a route for errors like this:
routes.MapRoute
(
"SharedError",
"Shared/Error/{error}",
new { error = "" }
);
And calling like:
return parentController.RedirectToRoute("SharedError", new RouteValueDictionary(new { error = errorMessage.ToString() }));
And on the controller:
public ActionResult Error(String error)
Simple right? Well when this is actually run, error is null despite the url looking like:
/Shared/Error/ThisIsTheError
But the error parameter in the Error method is null. (And yes I've tried other words)
Now if I replace all that with the word 'id' everything works.
Global.asax.cs
routes.MapRoute
(
"SharedError",
"Shared/Error/{id}",
new { id = "" }
);
Redirect:
return parentController.RedirectToRoute("SharedError", new RouteValueDictionary(new { id = errorMessage.ToString() }));
Shared Controller:
public ActionResult Error(String id)
Is id a must have word for all routes if you have a default route taking in a value?