我要创建一个类似于website.com/sea/season/23/team
的网址这是MapRoute
routes.MapRoute(
"SeaTeam",
"sea/season/{seasonId}/team/{action}/{name}",
new { controller = "Team", action = "Index", name = UrlParameter.Optional }
);
Html.ActionLink看起来像
@Html.ActionLink("Add Team", "Index", "SeaTeam", new { seasonId = seasons.id }, null)
但它生成以下网址
<a href="/SeaTeam?seasonId=1">Add Team</a>
任何见解?感谢...
更新
这是控制器
public class TeamController : Controller
{
//
// GET: /Team/
public ActionResult Index()
{
//get the seasons of the loged user
var loadedTeam = tempFunctions.getSeasonsOf(CustomHelper.UserGuid(User.Identity.Name));
return View("Team/ManageTeam", loadedTeam);
}
答案 0 :(得分:1)
尝试:
@Html.ActionLink(
"Add Team", // linkText
"Index", // Action
"Team", // Controller
new { seasonId = seasons.id },
null)
我没有看到SeaTeam
控制器