Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

How can I customize this error message?

$
0
0

Hello,

I extended System.Web.Http.AuthorizeAttribute, and provided implementation of IsAuthorized method.

When the authorization failed, the error message I got is {"message":"Authorization has been denied for this request."} provided by ASP.NET Web API.

Is there any way I can customize this error message?

For example, what if I want to response out like {"message":"...", "deatil" : "blahblah"} when authorization failed?

Thanks,


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>