I have added some logic into an ActionFilter to redirect from one page to another, but am wondering if there is a better way to target a page without just looking at the RouteData. My current filter is doing something like this:
public void OnActionExecuting(ActionExecutingContext filterContext)
var path = filterContext.RouteData.Values["path"] as string ?? string.Empty;
var area = filterContext.RouteData.Values["area"] as string ?? string.Empty;
I am basically looking to replace the if condition with something a bit more robust. Can I easily access the current content item and look at a particular property that won't change?
I imagine Orchard might not even know what content item is being requested at this point as the filter will be running before the the ItemController's Display action. If so can anybody suggest a better way of achieving this redirect? If it helps at all,
what I am verifying is that an ID stored on the query string is present and valid (based on some custom rules) for a particular page.