title: Authorisation Filter continues on when status code set .net core 2.1
body: <p>On my Controller Method I have:</p>
  
  <pre><code>public class HomeController : Controller
  {
      [Authorisation(),HttpGet]
      public IActionResult Index()
      {
            return View("~/Views/Home/Index.cshtml");
      }
  }
  </code></pre>
  
  <p>In my Authorisation filter I have:</p>
  
  <pre><code>public void OnAuthorization(AuthorizationFilterContext context)
  {
     …..
     context.HttpContext.Response.StatusCode = StatusCodes.Status401Unauthorized;
              return;
     …..
  </code></pre>
  
  <p>When it hit's the above code in my authorisation filter. The code still continues to the view. Placing a breakpoint on the view, if I then do the following in the immediate window:</p>
  
  <pre><code>this.ControllerContext.HttpContext.Response.StatusCode
  </code></pre>
  
  <p>It returns me 401 as expected.</p>
  
  <p>back in my startup.cs file I have:</p>
  
  <pre><code>app.Use(async (context, next) =&gt;
  {
      await next.Invoke();
      if (context.Response.StatusCode == 401)
      {
          context.Response.Redirect("/user/signin/");
      }
  });
  </code></pre>
  
  <p>I don't understand why the controller continues through to the view under this condition.</p>