1 Answer
1

The correct way to achieve this is to use a custom action filter and inside use either filterContext.ActionDescriptor.GetParameters() or fetch the required parameter from RouteData. You cannot have dynamic values in an attribute declaration because attributes represent metadata that are baked into the assembly at compile time => .NET doesn't allow you this. Only static or constant parameters could be used at attribute declaration.