/// <summary> /// Add a route which generates an http redirect to another url /// </summary> /// <param name="routes">The route collection</param> /// <param name="name">Name of the route table entry</param> /// <param name="url">The url matching pattern</param> /// <param name="mapUrl">The url to redirect to including matched elements from the url matching pattern</param> /// <param name="defaults">Default values for matched elements</param> /// <param name="constraints">Constraints for when the route should match</param> /// <returns>The RedirectRoute that was created and registered</returns> static public RedirectRoute Redirect(this RouteCollection routes, string name, string url, string mapUrl, object defaults, object constraints) { var route = new RedirectRoute(url, mapUrl, new RouteValueDictionary(defaults), new RouteValueDictionary(constraints), new MvcRouteHandler()); routes.Add(name, route); return(route); }
/// <summary> /// Add a route which generates an http redirect to another url /// </summary> /// <param name="routes">The route collection</param> /// <param name="name">Name of the route table entry</param> /// <param name="url">The url matching pattern</param> /// <param name="mapUrl">The url to redirect to including matched elements from the url matching pattern</param> /// <returns>The RedirectRoute that was created and registered</returns> static public RedirectRoute Redirect(this RouteCollection routes, string name, string url, string mapUrl) { var route = new RedirectRoute(url, mapUrl, new MvcRouteHandler()); routes.Add(name, route); return(route); }