My api endpoints are using asp.net mvc (4) web api controllers.
Are there any events similiar to how mvc has OnActionExecuting?
Also, how to I access the Req
Use action filters.
public class MyActionFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
//use filterContext.HttpContext.Request...
}
}
For your controller action, apply the attribute
[MyActionFilter]
public Action MyAction(...)
{
//...
}
As Satpal mentioned in his comment, you might actually want to use AuthorizeAttribute to authorize access to your actions.