I would like to define following attribute on MVC2:
public class BackAttribute : ActionFilterAttribute
{
public BackAttribute(object routeDict)
{ // Set local route property according to routeDict }
}
Attribute would be used like this with anonymous type:
[Back(new { action = "Index", controller = "Home" })]
public ViewResult DoSome() ...
What I am trying to achieve is "back" attribute that defines where the "back" button in a page will lead to. Previous code doesn't compile because apparently it is a constant expression and you can't use anonymous type in that. How could I pass anonymous type to attribute or achieve one of the following calls:
[Back(new { action = "Index", controller = "Home"})]
[Back(action = "Index", controller = "Home")]
(Update) Or even
[Back(action = "Index", controller = "Home", id = "5", younameit = "dosome")]