Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static string GetRouteURL(object routeValues)
- {
- UrlHelper url = new UrlHelper(
- new RequestContext(
- new HttpContextWrapper(HttpContext.Current),
- new RouteData()),
- RouteTable.Routes);
- return url.RouteUrl(routeValues);
- }
- public override void ExecuteResult(ControllerContext context)
- {
- var httpContext = HttpContext.Current;
- // ASP.NET MVC 3.0
- if (context.Controller.TempData != null &&
- context.Controller.TempData.Count() > 0)
- {
- throw new ApplicationException(
- "TempData won't work with Server.TransferRequest!");
- }
- // change to false to pass query string parameters
- // if you have already processed them
- httpContext.Server.TransferRequest(Url, true);
- // ASP.NET MVC 2.0
- //httpContext.RewritePath(Url, false);
- //IHttpHandler httpHandler = new MvcHttpHandler();
- //httpHandler.ProcessRequest(HttpContext.Current);
- }
- }
Add Comment
Please, Sign In to add comment