Exemple #1
0
        public static string GenerateUrl(
            string routeName,
            string actionName,
            string controllerName,
            RouteValueDictionary routeValues,
            RouteCollection routeCollection,
            RequestContext requestContext,
            bool includeImplicitMvcValues
            )
        {
            if (routeCollection == null)
            {
                throw new ArgumentNullException("routeCollection");
            }

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

            RouteValueDictionary mergedRouteValues = RouteValuesHelpers.MergeRouteValues(
                actionName,
                controllerName,
                requestContext.RouteData.Values,
                routeValues,
                includeImplicitMvcValues
                );

            VirtualPathData vpd = routeCollection.GetVirtualPathForArea(
                requestContext,
                routeName,
                mergedRouteValues
                );

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

            string modifiedUrl = UrlUtil.GenerateClientUrl(
                requestContext.HttpContext,
                vpd.VirtualPath
                );

            return(modifiedUrl);
        }
Exemple #2
0
        protected internal virtual RedirectToRouteResult RedirectToActionPermanent(
            string actionName,
            string controllerName,
            RouteValueDictionary routeValues
            )
        {
            RouteValueDictionary implicitRouteValues =
                (RouteData != null) ? RouteData.Values : null;

            RouteValueDictionary mergedRouteValues = RouteValuesHelpers.MergeRouteValues(
                actionName,
                controllerName,
                implicitRouteValues,
                routeValues,
                includeImplicitMvcValues: true
                );

            return(new RedirectToRouteResult(null, mergedRouteValues, permanent: true));
        }
        public static string GenerateUrl(out IDynamicNode node, string routeName, string actionName, string controllerName, RouteValueDictionary routeValues, RouteCollection routeCollection, RequestContext requestContext, bool includeImplicitMvcValues)
        {
            if (routeCollection == null)
            {
                throw new ArgumentNullException("routeCollection");
            }
            if (requestContext == null)
            {
                throw new ArgumentNullException("requestContext");
            }
            var values = RouteValuesHelpers.MergeRouteValues(actionName, controllerName, requestContext.RouteData.Values, routeValues, includeImplicitMvcValues);
            var data   = routeCollection.GetVirtualPathForArea(requestContext, routeName, values);

            if (data == null)
            {
                node = null;
                return(null);
            }
            node = (IDynamicNode)data.DataTokens["dynamicNode"];
            return(PathHelpers.GenerateClientUrl(requestContext.HttpContext, data.VirtualPath));
        }
Exemple #4
0
 protected internal virtual RedirectToRouteResult RedirectToRoutePermanent(string routeName, RouteValueDictionary routeValues)
 {
     return(new RedirectToRouteResult(routeName, RouteValuesHelpers.GetRouteValues(routeValues), permanent: true));
 }
 protected internal virtual RedirectToRouteResult RedirectToRoute(string routeName, RouteValueDictionary routeValues) {
     return new RedirectToRouteResult(routeName, RouteValuesHelpers.GetRouteValues(routeValues));
 }
Exemple #6
0
 public static RedirectToRouteResult RedirectToRouteEx(this Controller controller, string routeName, RouteValueDictionary routeValues)
 {
     return(new RedirectToRouteResultEx(routeName, RouteValuesHelpers.GetRouteValues(routeValues)));
 }
Exemple #7
0
 protected internal virtual RedirectToRouteResult RedirectToAction(string actionName, string controllerName, RouteValueDictionary routeValues)
 {
     return(new RedirectToRouteResult(this.RouteData != null ? RouteValuesHelpers.MergeRouteValues(actionName, controllerName, this.RouteData.Values, routeValues, true) : RouteValuesHelpers.MergeRouteValues(actionName, controllerName, (RouteValueDictionary)null, routeValues, true)));
 }