c# - Routes MVC Problem -
I have read a lot, and I do not see my head.
Could some body help me please
My global. ASX
Public static zero register routes {routes.IgnoreRoute ("{resource} .axd / {* pathInfo}"); New {controller = "home", action = "index", id = ""} with routes ("default", // root name "{controller} / {action} / {id}", // URL parameter / Parameter defaults); Routes.MapRoute ("user name", "account / {action} / {username}", new {action = "EditProfile", administrator = "account"}); } Protected Zero application_Start () {RegisterRout (RouteTable.Rout); }
When I
& lt;% = Html.ActionLink ("edit account", "edit profiles", "account", new {username} = Html.Encode (Page.User Identification.Name)}, Faucet)%>
I did not get the job
If I tried to call the URL directly as
.My method is in my AccountController
public ActionResult EditProfile (String Username) {View (ServiceFactory.UserAccount.GetUserByUserName (New GetUserByUserNameArgs (username)); }
I do not know where my fault is, can some body help me? Thank you.
After reading the "itemprop =" text ">
The routes are top down, your" catching "needs to be past the normal route.
routes.MapRoute ("user name", "account / {action} / {username}", new {action = "EditProfile", controller = "account"}); URL (Controller = "home", action = "index", id = "" with the new parameters, "route.MapRoute (" default ", // path name" {controller} "{{action} / {id}" } // parameter defaults);
Comments
Post a Comment