title: NancyFX - Custom 404 handler overrides every 404 response
body: <p>I did my custom 404 handler for NancyFX and it works fine but there is a problem. Problem is that it overrides even those requests where I want to send 404 code but with my custom message e.g. "User not found".</p>
  
  <h1>Handler</h1>
  
  <pre><code>public class NotFoundHandler : IStatusCodeHandler
  {
      public bool HandlesStatusCode(HttpStatusCode statusCode, NancyContext context)
      {
          if (statusCode == HttpStatusCode.NotFound)
          {
              // How to check here if the url actually exists?
              // I don't want every 404 request to be the same
              // I want to send custom 404 with Response.AsJson(object, HttpStatusCode.NotFound)
              return true;
          }
  
          return false;
      }
  
      public void Handle(HttpStatusCode statusCode, NancyContext context)
      {
          context.Response = new TextResponse(JsonConvert.SerializeObject(new { Message = "Resource not found" }, Formatting.Indented))
          {
              StatusCode = statusCode,
              ContentType = "application/json"
          };
      }
  }
  </code></pre>
  
  <h1>Problem</h1>
  
  <pre><code>Get["/"] = _ =&gt;
  {
      // This will not show "User not found", instead it will be overriden and it will show "Resource not found"
      return Response.AsJson(new { Message = "User not found" }, HttpStatusCode.NotFound);
  };
  </code></pre>