I have a case where an action requests some class of mine.
I created a special custom model binder for that class, for convenience purposes.
Sometimes the model binder needs to cancel the action as it didn’t find the class.
So it raises an exception.
But this doesn’t stop the action from running.
Is it possible to stop the controller from running the action?
Daniel
@RPM1984 is absolutally right, you cant simply cancel the current HTTP request. What you can do is to throw an HttpException() with statuscode 400 (Bad Request) which will have the effect i believe you are looking for, the consumer will get a 400 Bad Request http response for the offending request. Alternatively you could throw another HttpException with a different statuscode if it makes more sense in your context, for example 404 page not found