title: Handling exception in asp.net core for certain exception type?
body: <p>I have asp.net core application. To handle exception i am using one of the extension method from <code>Microsoft.AspNetCore.Diagnostics</code> </p>
  
  <pre><code> app.UseExceptionHandler("/Home/Error");
  </code></pre>
  
  <p>so when error occurs user gets redirected to error page.   </p>
  
  <p>I wanted to know how do i redirect user to certain page based on exception type? something like</p>
  
  <pre><code>if( exception is NotAuthorizedException)
  { 
      // redirect to "Home/NotAuthrozied"
  }
  else
  {
    // redirect to "Home/Error"
  }
  </code></pre>
  
  <p>How do i handle this inside <code>app.UseExceptionHandler()</code> method?<br>
  I have already looked <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/error-handling" rel="nofollow noreferrer">here</a> but couldnt find anything. I am also trying to avoid creating custom middleware to handle exception.</p>