In my API's I am extending a custom class (myClass
) which extends ApiController
.
What I want to do is in the constructor for myClass
, compare two values, and if they don't match, then kill the process. Meaning I don't want the functions in the API to actually get hit.
I'd like to return HttpStatusCode.Forbidden
but I don't want to have to modify existing API functions to check a value that could be set by the controller.
I can't seem to find a good way to kill the request in the constructor and return the HttpStatusCode
without blocking access to the rest of the API if it's supposed to continue to the requested API function.
Is there a relatively simple approach that could work for this?