From the course: ASP.NET: Security

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Error handling

Error handling

From the course: ASP.NET: Security

Start my 1-month free trial

Error handling

- [Instructor] In a hypothetical world, you anticipate each error and exception at the very position in the code where they may occur and therefore you don't have a problem. In the real world of course, quite often you see the yellow screen of death, yeah, that's the actual name of that yellow exception screen ASP.NET provides. There must be better options than that. The first approach would be that we use a custom error handler in the global.asax file or global.asax.cs. We just implement the Application_Error method which will be automatically called if there is an uncalled exception or an uncalled error within our application. In there, we can call Server.GetLastError which gives us the error or the details about the error and then we can handle the error. For instance, we could log into a database, we could redirect the user to an error page and on descriptive error page or we could do some other analytics just to make sure that we do log the error and we have a process that we'll…

Contents