title: ASP.Net 5 MVC 6, how to use shared Error.cshtml as default error response
body: <p><strong>ASP.Net 5 MVC 6, how to use shared Error.cshtml as default error response</strong></p>
  
  <p><em>when using Microsoft.AspNet.Diagnostics UseExceptionHandler middleware with a razor view</em> </p>
  
  <p>If you look at the sample code at <a href="https://github.com/aspnet/Diagnostics/tree/dev/samples/ExceptionHandlerSample/Startup.cs">https://github.com/aspnet/Diagnostics/tree/dev/samples/ExceptionHandlerSample/Startup.cs</a>
  explaning how to use Microsoft.AspNet.Diagnostics ErrorHandler middleware for ASP.Net 5,a comment say: </p>
  
  <p>// Normally you'd use MVC or similar to render a nice page.</p>
  
  <p>Ok, but how to do that ?</p>
  
  <pre><code>public class Startup
  {
      public void Configure(IApplicationBuilder app)
      {
          // Configure the error handler to show an error page.
          app.UseExceptionHandler(errorApp =&gt;
          {
              // Normally you'd use MVC or similar to render a nice page.
              errorApp.Run(async context =&gt;
              {
  </code></pre>