나는 많은 글을 읽었고, 나는 그 미스터리를 보지 못했다.Routes MVC Problem
신체가 나를 도와 줄 수 있습니까?
내가 처럼 직접 URL을 호출하려고하면 내가 URL을
http://localhost:8458/Account/EditProfile?username=cboivin
있어
<%= Html.ActionLink("Edit Account", "EditProfile", "Account", new { username = Html.Encode(Page.User.Identity.Name) },null) %>
사용하면 내 Global.asax에
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
routes.MapRoute("UserName", "Account/{action}/{username}",
new { action = "EditProfile", controller = "Account" });
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
}
있다 http://localhost:8458/Account/EditProfile/cboivin
에 작동하지 ...
내 방법 내 AccountController 나는 내 실수입니다 잘 모릅니다
public ActionResult EditProfile(string username)
{
return View(ServiceFactory.UserAccount.GetUserByUserName(new GetUserByUserNameArgs(username)));
}
에 있습니다. 어떤 시체가 나를 도울 수 있습니까? 감사.