I have an area named User, and I write MapRoute for it:
context.MapRoute(
"User_Category",
"User/Category/{categoryId}",
new { controller = "Product", action = "Category", categoryId = UrlParameter.Optional },
new { categoryId = @"\d+" }
);
This is other example, I have a link:
<%=Html.ActionLink("Điện thoại", "Category", new { area = "User", controller = "Product", id = 1 }, null) %>
(http://localhost:8578/User/Product/Category/1)
Sure, I can't do this:
<%=Html.ActionLink("Điện thoại", "User/Category", new { area = "User", controller = "Product", id = 1 }, null) %>
Following MapRoute above, it's modified. It means that it's in an Area, I don't know how to pass Area Name into ActionLink to have: http://localhost:8587/User/Category/1
But the thing I want is replace ActionLink to RouteUrl to get absolute link like **http://localhost:8587/User/Category/1**
What should I do? And how I can remove User Name in Url? Thanks for watching!