public static Route MapRouteLowercase(this RouteCollection routes, string name, string url, object defaults, object constraints, string[] namespaces)
        {
            if (routes == null)
            {
                throw new ArgumentNullException("routes");
            }

            if (url == null)
            {
                throw new ArgumentNullException("url");
            }

            var route = new LowercaseRoute(url, new MvcRouteHandler())
            {
                Defaults    = new RouteValueDictionary(defaults),
                Constraints = new RouteValueDictionary(constraints),
                DataTokens  = new RouteValueDictionary(namespaces),
            };

            if (namespaces != null && namespaces.Length > 0)
            {
                route.DataTokens["Namespaces"] = namespaces;
            }

            routes.Add(name, route);

            return(route);
        }
        public static Route MapRouteLowercase(this AreaRegistrationContext context, string name, string url, object defaults, object constraints, string[] namespaces)
        {
            if (namespaces == null && context.Namespaces != null)
            {
                namespaces = context.Namespaces.ToArray();
            }


            var route = new LowercaseRoute(url, new MvcRouteHandler())
            {
                Defaults    = new RouteValueDictionary(defaults),
                Constraints = new RouteValueDictionary(constraints),
                DataTokens  = new RouteValueDictionary()
            };


            if ((namespaces != null) && (namespaces.Length > 0))
            {
                route.DataTokens["Namespaces"] = namespaces;
            }


            route.DataTokens["area"] = context.AreaName;

            bool useNamespaceFallback = (namespaces == null || namespaces.Length == 0);

            route.DataTokens["UseNamespaceFallback"] = useNamespaceFallback;


            if (String.IsNullOrEmpty(name))
            {
                context.Routes.Add(route);
            }
            else
            {
                context.Routes.Add(name, route);
            }


            return(route);
        }