Returning 403 from custom binder
We are using some custom model bindings for our .Net Core api and have some logic in the glue module that should sometimes cause 403
our api to return .
I am aware that you can use Mvc.ModelBinding.ModelBindingResult.Failed()
to return 400
on unsuccessful model binding, however, if it was due to a failure as a result of an attempt to access Unauthorized
, we need to return 403
, ideally with a custom message.
+3
source to share
2 answers