views:

894

answers:

1

Hi, I have the following problem: For example I have route like this:

routes.Add(new Route("forums/thread/{threadOid}/last", new MvcRouteHandler())
                           Defaults = new RouteValueDictionary(
                            new { controller = "Thread", action ="ShowThreadLastPostPage"}),
                        Constraints = new RouteValueDictionary(new { threadOid = @"^\d+$" })
                    }
                );

Is there a way using RedirectToAction method navigate to the URL like this: forums/thread/{threadOid}/last#postOid

+7  A: 

I think you should use the Redirect method along with Url.RouteUrl to accomplish it.

return Redirect(Url.RouteUrl(new { controller = "Thread", action = "ShowThreadLastPostPage", threadOid = threadId }) + "#" + postOid);
Mehrdad Afshari
Thanks a lot, it helps!
Thank you so much for the answer, I've been wondering this for a while!
thebrokencube