title: Returning a 403 status code in Service Stack
body: <p>I have a web service using service stack and I'm putting in a blacklist check to stop the processing of requests from a list of the blacklisted IP addresses.</p>
  
  <p>How do I return a 403 status code back to the user?</p>
  
  <p>Here's what I've tried so far.</p>
  
  <pre><code>public static CustomHttpResult CheckIfIPIsBlackListed(string ipAddress)
          {
              try
              {
                  DataClasses1DataContext db = new DataClasses1DataContext();
                  int resultCount = (from r in db.WebService_BlackLists
                                     where r.BlackList_IPAddress == ipAddress
                                     select r).Count();
  
                  //check if we have 1 or more record
                  if(resultCount &gt;= 1)
                  {
                      return CustomHttpResult[HttpStatusCode.Forbidden];
                  }
  
                  return null;
              }
              catch (Exception exc)
              {
                  return null;
              }
          }
  </code></pre>