Esempio n. 1
0
        /// <summary>
        /// 解释分隔后的URL
        /// </summary>
        /// <param name="httpContext"> </param>
        /// <returns> </returns>
        public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            RouteData result = base.GetRouteData(httpContext);

            if (result == null)
            {
                return(null);
            }
            RouteValueDictionary dict = result.Values;

            foreach (string key in RequireKeys)
            {
                if (!dict.ContainsKey(key))
                {
                    continue;
                }
                object value = dict[key];
                if (!(value is string))
                {
                    continue;
                }
                dict[key] = LowerCaseUrlConverter.Restore(value as string);
            }
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 把Url中非参数字符转换为小写分隔的形式
        /// </summary>
        public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
        {
            RouteValueDictionary valueDict = new RouteValueDictionary(values);

            foreach (string key in RequireKeys)
            {
                if (!valueDict.ContainsKey(key))
                {
                    continue;
                }
                object value = valueDict[key];
                if (!(value is string))
                {
                    continue;
                }
                valueDict[key] = LowerCaseUrlConverter.Spliter(value as string);
            }
            return(base.GetVirtualPath(requestContext, valueDict));
        }