Asp.net mvc @用于自定义路由的html.ActionLink

Asp.net mvc @用于自定义路由的html.ActionLink,asp.net-mvc,asp.net-mvc-4,Asp.net Mvc,Asp.net Mvc 4,我想为我的应用程序提供以下类型的URL 因此,我创建了自定义路线,并在某种程度上实现了这一点。但现在的问题是,我如何生成这个URL表单ActionLink public class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.Map

我想为我的应用程序提供以下类型的URL

因此,我创建了自定义路线,并在某种程度上实现了这一点。但现在的问题是,我如何生成这个URL表单ActionLink

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
           name: "Custom",
           url: "{content}",
           defaults: new { controller = "Content", action = "Index" },
           namespaces: new[] { "Some.Web.Controllers" },
           constraints: new { IsContent = new IsContentPage() }
       );           

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            namespaces: new[] { "Some.Web.Controllers" }
        );

    }
}
URL约束

 public class IsContentPage : IRouteConstraint
{
    public bool Match
          (
              HttpContextBase httpContext,
              Route route,
              string parameterName,
              RouteValueDictionary values,
              RouteDirection routeDirection
          )
    {
        var enumlist = Enum.GetValues(typeof(Common.Content)).Cast<Common.Content>().Select(v => v.ToString().ToLower()).ToList();
        var keysValue = values.Select(x => x.Value.ToString().ToLower()).FirstOrDefault();
        Int32 isContent = enumlist.Where(x => x == keysValue).Count();
        if (isContent > 0)
        {
            return true;
        }
        return false;
    }
}
现在我如何生成链接,如

尝试:

@Html.ActionLink("My Custom Content", "Index", "Content")