+ public void RedirectToRoute (string routeName, object routeValues)
+ {
+ RedirectToRoute ("RedirectToRoute", routeName, new RouteValueDictionary (routeValues), 302, true);
+ }
+
+ public void RedirectToRoute (string routeName, RouteValueDictionary routeValues)
+ {
+ RedirectToRoute ("RedirectToRoute", routeName, routeValues, 302, true);
+ }
+
+ public void RedirectToRoutePermanent (object routeValues)
+ {
+ RedirectToRoute ("RedirectToRoutePermanent", null, new RouteValueDictionary (routeValues), 301, false);
+ }
+
+ public void RedirectToRoutePermanent (RouteValueDictionary routeValues)
+ {
+ RedirectToRoute ("RedirectToRoutePermanent", null, routeValues, 301, false);
+ }
+
+ public void RedirectToRoutePermanent (string routeName)
+ {
+ RedirectToRoute ("RedirectToRoutePermanent", routeName, null, 301, false);
+ }
+
+ public void RedirectToRoutePermanent (string routeName, object routeValues)
+ {
+ RedirectToRoute ("RedirectToRoutePermanent", routeName, new RouteValueDictionary (routeValues), 301, false);
+ }
+
+ public void RedirectToRoutePermanent (string routeName, RouteValueDictionary routeValues)
+ {
+ RedirectToRoute ("RedirectToRoutePermanent", routeName, routeValues, 301, false);
+ }
+
+ void RedirectToRoute (string callerName, string routeName, RouteValueDictionary routeValues, int redirectCode, bool endResponse)
+ {
+ HttpContext ctx = context ?? HttpContext.Current;
+ HttpRequest req = ctx != null ? ctx.Request : null;
+
+ if (req == null)
+ // Let's emulate .NET
+ throw new NullReferenceException ();
+
+ VirtualPathData vpd = RouteTable.Routes.GetVirtualPath (req.RequestContext, routeName, routeValues);
+ string redirectUrl = vpd != null ? vpd.VirtualPath : null;
+ if (String.IsNullOrEmpty (redirectUrl))
+ throw new InvalidOperationException ("No matching route found for RedirectToRoute");
+
+ Redirect (redirectUrl, true, redirectCode);
+ }
+
+ public static void RemoveOutputCacheItem (string path, string providerName)
+ {
+ if (path == null)
+ throw new ArgumentNullException ("path");
+
+ if (path.Length > 0 && path [0] != '/')
+ throw new ArgumentException ("Invalid path for HttpResponse.RemoveOutputCacheItem: '" + path + "'. An absolute virtual path is expected");
+
+ OutputCache.RemoveFromProvider (path, providerName);
+ }
+#endif