更新时间:2023-02-24 10:54:45
请试用此代码routes.MapRoute(
DefaultCustom, // 路线名称
{action} / {Name}, // 包含以下内容的网址操作和类别
new {controller = 帐户,action = 操作,Name = UrlParameter.Optional } // 参数默认值
);
Currently the url structure for the sign - up page is:
http://www.ABC.com/Account/Create?subscr=1
I'm wondering how hard it would be to create a "friendly url" for an existing product so it would read something like:
http://www.ABC.com/DiscountOffer
Please try this coderoutes.MapRoute( "DefaultCustom", // Route name "{action}/{Name}", // URL with Action and category new { controller = "Account", action = "Action", Name= UrlParameter.Optional } // Parameter defaults );
Please check this article
Routing in MVC [^]