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

How do you return 403 Forbidden from controller method in WEB API 2?

$
0
0

Inside my method I want to do something like this:

if (...)
return Request.CreateErrorResponse(HttpStatusCode.Forbidden, "RFID is disabled for this site.");

but I get error "cannot impilicitly conver HttpResponseMessage to IHttpActionResult.

What is the correct way to return 403 please?


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>