路由值绑定
给出一些默认路由,如 {controller=Home}/{action=Index}/{id?}
,如果你有 url https://stackoverflow.com/questions/1558902
这将转到 QuestionsController,值 1558902 将映射到索引操作的 id 参数,即
public ActionResult Index(int? id){
//id would be bound to id of the route
}
给出一些默认路由,如 {controller=Home}/{action=Index}/{id?}
,如果你有 url https://stackoverflow.com/questions/1558902
这将转到 QuestionsController,值 1558902 将映射到索引操作的 id 参数,即
public ActionResult Index(int? id){
//id would be bound to id of the route
}