Global Exception Handler in asp.net core

In the ASP 5 aka core all configuration from former MVC 5 global.asax goes into new root Startup.cs file.

So In startup.cs file in Configure Method

simple write

If it is api request then error will be shown like html or return to default error page we have made for exception handling

or you can use your own Exception handling middle ware

and startup.cs->Configure

Leave a Reply

Your email address will not be published. Required fields are marked *