BuildUrl() публичный Метод

public BuildUrl ( Route route, System.Web.Routing.RequestContext requestContext, RouteValueDictionary userValues, string &value ) : bool
route Route
requestContext System.Web.Routing.RequestContext
userValues RouteValueDictionary
value string
Результат bool
Пример #1
0
        public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
        {
            if (requestContext == null)
            {
                throw new ArgumentNullException("requestContext");
            }
            if (url == null)
            {
                return(new VirtualPathData(this, String.Empty));
            }

            // null values is allowed.
            // if (values == null)
            //  values = requestContext.RouteData.Values;

            RouteValueDictionary usedValues;
            string resultUrl = url.BuildUrl(this, requestContext, values, Constraints, out usedValues);

            if (resultUrl == null)
            {
                return(null);
            }

            if (!ProcessConstraints(requestContext.HttpContext, usedValues, RouteDirection.UrlGeneration))
            {
                return(null);
            }

            var result = new VirtualPathData(this, resultUrl);

            RouteValueDictionary dataTokens = DataTokens;

            if (dataTokens != null)
            {
                foreach (var item in dataTokens)
                {
                    result.DataTokens[item.Key] = item.Value;
                }
            }

            return(result);
        }
Пример #2
0
        public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
        {
            if (requestContext == null)
            {
                throw new ArgumentNullException("requestContext");
            }
            if (url == null)
            {
                return(new VirtualPathData(this, String.Empty));
            }

            // null values is allowed.
            // if (values == null)
            //  values = requestContext.RouteData.Values;

            string s;

            if (!url.BuildUrl(this, requestContext, values, out s))
            {
                return(null);
            }

            return(new VirtualPathData(this, s));
        }