I want to create web api 2 custom attribute with parameter from client, and return data to client there is something wrong.
for example data from client:
{ id : 1, _token : 221 }
for example on server:
//SomeController Action
[CustomActionFilter]
public String Foo(int id)
{
return id;
}
public class CustomActionFilter : ActionFilterAttribute, IActionFilter
{
void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext)
{
//get _token from client httprequest parameter
//return to client if _token != 221
//next proccess if _token == 221
// in real case, will cek token in db and compare it
}
}
please help how to get _token in CustomActionFilter and return to client error message with json format if _token != 221?
also if no problem along proccess do next proccess?