Asp.net MVC Tips(routing)
纯属个人记录,即时添加。
1. Register routesroutes. MapRoute(
"default",
"{controller}/{action}/{id}/{name}",
new { controller = "Home", action = "Index", id = "", name = "" }
);
2. Controller:
public ActionResult Indexa(int id, string name)
{
ViewData[ "Message"] = "Welcome to ASP.NET MVC! " + id + " " + name;
return View("Index");
}
3. Viewpage:
@Html.ActionLink( "To home", "indexa","home", new{id="5687",name="hahaha"},"");