views:

73

answers:

1

I'm trying to create an extension method similar to MVCContrib's RedirectToAction method by creating a method that will take an #anchor argument and add it to the Url. I am familiar with this question but it's not strongly typed. It's also possible to add values to the query-string, but that won't work for an anchor.

public static RedirectToRouteResult RedirectToAction<T>(this Controller controller, Expression<Action<T>> action, string anchor) where T : Controller
{
   var result = new RedirectToRouteResult<T>(action);

   // how can I add the #anchor to the result's url?

   return result;
}
A: 

See http://stackoverflow.com/questions/602788/asp-net-mvc-redirecttoaction-with-anchor

Aaron
Not strongly typed, it uses "magic strings". I referenced that in the question.
mxmissile