public static string GenerateUrl(this RouteValueDictionary routeValues, RouteCollection routes) { var context = new FakeHttpContext("/", "~/"); var requestContext = new RequestContext(context, new RouteData()); var url = UrlHelper.GenerateUrl(null, null, null, routeValues, routes, requestContext, true); return url; }
public static RouteData GetRouteDataForUrl(this RouteCollection routes, string url) { var context = new FakeHttpContext("/", url); var routeData = routes.GetRouteData(context); return routeData; }