Exemplo n.º 1
0
 public static Route MapRedirectRoute(this AreaRegistrationContext context, string routeUrl, RouteReference redirectRoute, params IRouteConstraint[] constraints)
 {
     return(context.MapRedirectRoute(routeUrl, redirectRoute, null, constraints));
 }
Exemplo n.º 2
0
        public static Route MapRedirectRoute(this AreaRegistrationContext context, string routeUrl, RouteReference redirectRoute, object routeValues, params IRouteConstraint[] constraints)
        {
            var routeValueDictionary = routeValues == null ? null : new RouteValueDictionary(routeValues);

            var route = new Route(GetMapRouteUrl(routeUrl), new RedirectRouteHandler(redirectRoute, routeValueDictionary, true))
            {
                Constraints = CreateConstraints(false, routeValueDictionary, constraints)
            };

            context.Routes.Add(route);
            return(route);
        }
Exemplo n.º 3
0
        private static ReadOnlyApplicationUrl GenerateUrl(this RouteReference route, RequestContext requestContext, RouteCollection routeCollection, RouteValueDictionary routeValues)
        {
            var url = UrlHelper.GenerateUrl(route.Name, null, null, routeValues, routeCollection, requestContext, false);

            return(new ReadOnlyApplicationUrl(route.EnsureHttps, RemoveDefaultAspx(url)));
        }
Exemplo n.º 4
0
 public static ReadOnlyApplicationUrl GenerateUrl(this RouteReference route, RouteValueDictionary routeValues)
 {
     return(route.GenerateUrl(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData()), RouteTable.Routes, routeValues));
 }
Exemplo n.º 5
0
 public AreaRoute(string name, bool?ensureHttps, string url, IRouteHandler routeHandler)
     : base(GetUrl(url), routeHandler)
 {
     _reference = new RouteReference(name, ensureHttps);
 }
Exemplo n.º 6
0
 public RedirectRouteHandler(RouteReference redirectRoute, RouteValueDictionary routeValues, bool permanently)
 {
     _redirectRoute = redirectRoute;
     _routeValues   = routeValues;
     _permanently   = permanently;
 }