User という名前のエリアがあり、そのために MapRoute を書きます。
context.MapRoute(
"User_Category",
"User/Category/{categoryId}",
new { controller = "Product", action = "Category", categoryId = UrlParameter.Optional },
new { categoryId = @"\d+" }
);
これは他の例です。リンクがあります:
<%=Html.ActionLink("Điện thoại", "Category", new { area = "User", controller = "Product", id = 1 }, null) %>
(http://localhost:8578/User/Product/Category/1)
確かに、私はこれを行うことはできません:
<%=Html.ActionLink("Điện thoại", "User/Category", new { area = "User", controller = "Product", id = 1 }, null) %>
上記の MapRoute に続いて、変更されています。エリア内にあることを意味します。エリア名を ActionLink に渡して次のようにする方法がわかりません。http://localhost:8587/User/Category/1
しかし、私が欲しいのは、ActionLinkをRouteUrlに置き換えて、次のような絶対リンクを取得することです**http://localhost:8587/User/Category/1**
私は何をすべきか?また、URL のユーザー名を削除するにはどうすればよいですか? 見てくれてありがとう!