I have this sole route in my app:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = ""}
);
This works great for URLs like:
/Blah/Index
/Blah/Create /Blah/Details/5
I want to add text to that last one like SO does:
/Blah/Details/5/Page-Title-Here-Or-Whatever
So my question is:
What should my routes look like to 开发者_JS百科accomplish this? (or if it doesn't have anything to do with routes...what do I do?)
MSDN Link: http://msdn.microsoft.com/en-us/library/cc668201.aspx
routes.MapRoute(
"Default",
"{controller}/{action}/{id}/{*allTheRest}",
new { controller = "Home", action = "Index", id = "", allTheRest=""}
);
Function signature should be similar to
public ActionResult MyAction(int? id, string rest)
{
this.TempData["ID"] = id ?? -1000;
this.TempData["REST"] = rest ?? "Not Provided";
return View();
}
精彩评论