public static string GetUrl(this IRoutablePage page, string name) { var pathInfo = RouteTable.Routes.GetVirtualPath(page.RequestContext, name, new RouteValueDictionary()); if (pathInfo != null) { return(pathInfo.VirtualPath); } return(null); }
public static string RouteLink(this IRoutablePage page, string name, string text) { var pathInfo = RouteTable.Routes.GetVirtualPath(page.RequestContext, name, new RouteValueDictionary()); if (pathInfo != null) { //I do something funky here with the link text for demo purposes return(string.Format("<a href=\"{0}\">{1}</a>", pathInfo.VirtualPath, text ?? pathInfo.VirtualPath)); } return(null); }
public static string RouteLink(this IRoutablePage page, string name) { return(RouteLink(page, name, null)); }