title: Handle only controller requests with middleware
body: <p>I have simple asp core middleware</p>
  
  <pre><code>using System.Diagnostics;
  using System.Threading.Tasks;
  using Microsoft.AspNetCore.Http;
  
  namespace Web.Identity
  {
      public class UserContextHttpMiddleware
      {
          private readonly RequestDelegate _next;
  
          public UserContextHttpMiddleware(RequestDelegate next)
          {
              _next = next;
          }
  
          public Task Invoke(HttpContext context)
          {
              Trace.WriteLine(context.Request.Path);
  
              return _next(context);
          }
      }
  }
  </code></pre>
  
  <p>After refresh page i have this in output</p>
  
  <pre><code>/
  /assets/images/avatar-2.jpg
  /assets/images/avatar-3.jpg
  /assets/images/avatar-6.jpg
  /assets/images/avatar-5.jpg
  /assets/images/avatar-7.jpg
  /assets/images/avatar-8.jpg
  /assets/images/avatar-4.jpg
  /assets/images/avatar-1.jpg
  /images/user-background.png
  /assets/images/avatar-10.jpg
  /assets/images/avatar-9.jpg
  </code></pre>
  
  <p>First line is request to controler. Other lines is requests to static content.
  So, how can i filter only request that will be handled by controller and ignore request to static content? How can know is current request is request to controller?</p>