0
我RouteConfig文件設置默認路由URL和屬性路由?如何
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapMvcAttributeRoutes();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Employee", action = "Index", id = UrlParameter.Optional }
);
我控制器
[Route("EMS/{Employee}")]
public ActionResult Index()
{
return View();
}
我工作的網址是 http://localhost:6628/EMS/Employee
,但我想用簡單的http://localhost:6628作爲我的默認網址爲無MapMvcAttributeRoutes( )它工作正常
我該如何使用這兩者在像默認的控制器操作同一項目必須是員工和指數,並在點擊路徑URL EMS /員工這樣工作
<td>
<input type="button" id="ROUTE" value="ROUTE" onclick="location.href='@Url.Action("Employee", "EMS")'" class="btn-info" />
</td>
使用更好的控制器示例更新問題。這有點令人困惑。僅僅顯示行動是不夠的。 – Nkosi