Reputation: 22760
I want to apply an action filter on one of my ActionResult methods.
I want to be able to pass to the ActionFilterAttribute the currently logged in user id.
Is there either a way I can pass the user to the attribute or have the attribute pick up the logged in user?
Upvotes: 1
Views: 4050
Reputation: 7452
Note that there are two different ActionFilterAttributes:
System.Web.Http.Filters.ActionFilterAttribute does not have an HttpContext property while System.Web.Mvc.ActionFilterAttribute does
If you are having trouble figuring out how to get the http context from within your filter its probably because you are using the wrong one.
Upvotes: 1
Reputation: 24754
See:
MVC: creating a custom [AuthorizeAttribute] which takes parameters?
Lol, didn't realize I sent you on a double hop, direct link:
How to pass parameters to a custom ActionFilter in ASP.NET MVC 2?
Upvotes: 1