Divide By Zero With Exception : Exception « Development « ASP.NET Tutorial






<script language="C#" runat="server">
protected void Page_Load(object o, EventArgs e) {
    try {
        int x;
        int y;
        x = 5;
        y = 0;
        int result = x / y;
        string message = "result is: " + result;
        Response.Write(message);
    }
    catch(DivideByZeroException) {
        Response.Write("divisor can't be zero");
    }
}
</script>








9.18.Exception
9.18.1.What is going to happen if there is no exception handler
9.18.2.Divide By Zero With Exception
9.18.3.Catch exception and display exception message, Source and StackTrace (C#)
9.18.4.Page-level error handling
9.18.5.Application-level error handling
9.18.6.Try to catch error when converting text value to number
9.18.7.Use Global.asax to log application level exception
9.18.8.Generic error handler page
9.18.9.Transfer to different page based on exception type