从ASP.NET MVC路由生成URL

| 如果我有一些设置如下的路线:
context.MapRoute(\"Route1\", \"Public/DataCapture/Name\", new { controller = \"Profile\", action = \"Name\" } );

context.MapRoute(\"Route2\", \"Public/DataCapture/Age\", new { controller = \"Profile\", action = \"Age\" } );

context.MapRoute(\"Route2\", \"Public/DataCapture/Amount\", new { controller = \"Income\", action = \"Amount\" } );
如何生成使用路由路径而不是实际控制器/操作路径的URL? 例如。
Url.Action(\"Name\", \"Profile\")
应该生成\“ Public / DataCapture / Name \”,而不是\“ Public / Profile / Name \”     
已邀请:
尝试使用Url.RouteUrl。 过去,当我遇到问题,无法返回正确的路线时,通常表明我的路线未按正确的顺序定义,或者我做的事情使路由系统无法匹配我想要的路线。     

要回复问题请先登录注册