title: RouteTable.Routes.GetVirtualPath with route data asp.net MVC 2
body: <p>I'm trying to get a URL from my routes table.  Here is the method.</p>
  
  <pre><code>private static void RedirectToRoute(ActionExecutingContext context, string param)
      {
          var actionName = context.ActionDescriptor.ActionName;
          var controllerName = context.ActionDescriptor.ControllerDescriptor.ControllerName;
  
          var rc = new RequestContext(context.HttpContext, context.RouteData);
          string url = RouteTable.Routes.GetVirtualPath(rc, new RouteValueDictionary(new { actionName = actionName, controller = controllerName, parameter = param })).VirtualPath;
          context.HttpContext.Response.Redirect(url, true);
  
      }
  </code></pre>
  
  <p>I'm trying to map it to.  However RouteTable.Routes.GetVirtualPath(rc, new RouteValueDictionary(new { actionName = actionName, controller = controllerName, parameter = param })) keeps giving me null.  Any thoughts?</p>
  
  <pre><code>routes.MapRoute(
              "default3",                                              // Route name
              "{parameter}/{controller}/{action}",                           // URL with parameters
              new { parameter= "parameterValue", controller = "Home", action = "Index" }
  
          );
  </code></pre>
  
  <p>I know I can use redirectToAction and other methods, but I would like to change the URL in the browser with new routedata.</p>