Answers for "Generic Exception Handler"

0

Generic Exception Handler

app.UseExceptionHandler(appBuilder =>
           {
               appBuilder.Run(async context =>
               {
                   context.Response.Headers.Add("Access-Control-Allow-Origin", "*");   // I needed to add this otherwise in Angular I Would get "Response with status: 0 for URL"
                   context.Response.StatusCode = 500;
                   await context.Response.WriteAsync("Internal Server Error");
               });
           });
Posted by: Guest on June-19-2021

Code answers related to "Generic Exception Handler"

Browse Popular Code Answers by Language