目前,我有http://localhost:xxxxx/Register,显示从数据库中检索的表格。
eName eLink fWidth fHeight
channel-new-asia http://www.channelnewsasia.com/ 1024 768 注册
现在,注册链接就像http://localhost:xxxxx/Register/Event/1?name=channel-news-asia,我该怎样做http://localhost:xxxxx/Register/Event?name=channel-news-asia
答案 0 :(得分:1)
默认情况下,MVC使用此路由:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } //Parameter defaults
);
将名称为“id”的参数放入页面上的请求somwhere。因此,URL包含'id'参数。您需要使用其他名称(不是'id'),或者您应该更改默认名称。