From the course: ASP.NET Web Forms Essential Training

Unlock the full course today

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

Handle exceptions from code

Handle exceptions from code - ASP.NET Tutorial

From the course: ASP.NET Web Forms Essential Training

Start my 1-month free trial

Handle exceptions from code

- [Narrator] So, we've seen how you can handle exceptions. Generally, you know how we can configure application to handle exceptions. I'd like to show you the exception that was thrown or to actually show you a custom error page, in case that happens. But, it's not really handling. It's just offering information to the user. So, let's see what are our options to handle exceptions. If we know the kind of exception, or if we expect some kind of exceptions, we can use a Try-Catch block. So, in our case, if we would expect that this could be an empty string, I would have had a, try and catch block, around it. And, if I would've called this application exception, instead of crashing the whole application, I would've just gone and say, please fix that error, or do something about it. Now, when I say, crashing the whole application, I'm not crashing DIOS, I'm just crashing the current request that I make into the server. So, I can always go back to the previous page and get the data of the…

Contents