The problem is that you do not have a route that matches a route that ends in a line.
, :
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = 0 },
new { id = "[0-9]" }
);
routes.MapRoute(
"Default2",
"{controller}/{action2}/{sid}",
new { controller = "Home", action = "Index2", sid = "" }
);
public ActionResult Index(int id)
{
ViewData["Title"] = "Home Page";
ViewData["Message"] = "Welcome to ASP.NET MVC! Your id is: "+ id.ToString();
return View();
}
public ActionResult Index2(string sid)
{
ViewData["Title"] = "Home Page 2."+sid.ToString();
ViewData["Message"] = "Welcome to ASP.NET MVC! \"" + sid.ToString() +"\" is an invalid id";
return View("index");
}
, , Index2, , , .