There is a way to do this _in ASP.NET MVC_ with action-methods (not with attributes in general)
public class CustomAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
int userId = (int)filterContext.ActionParameters["userId"];
}
}