title: Implementing custom authorization filter to ASP.Net Web API
body: <p>First time I am implementing authorization in ASP.Net Web API. I have a requirement to implement custom authorization for my web API project. The requirement is to authorize the users against an existing table. I came across <a href="http://www.infoworld.com/article/2988903/application-architecture/how-to-secure-web-api-using-authorization-filters.html" rel="nofollow">this</a> link. I want to know how the unauthorized request is handled? How do we make sure that "HandleUnauthorizedRequest" sends the "unauthorized" message and do not let the application execute the API method. Specifically what to write in:</p>
  
  <pre><code>HandleUnauthorizedRequest(System.Web.Http.Controllers.HttpActionContext actionContext)
  {
  //Code to handle unauthorized request. Give the user error message instead of serving the request.
  }
  </code></pre>
  
  <p>Is there any better way to implement SQL table based authorization for ASP.Net Web API?</p>