Employ Error Handling With ASP

Employ Error Handling With ASP

Without error handling, any ASP (Active Server Pages) error is fatal as it will stop the execution of your page. To bullet proof your ASP, you can add error handlers. In ASP, you generally don’t need “global” error handling. However, there are probably some small segments of your code, such as a function or two, where you suspect runtime errors are probable. To start the error handling, use “on error resume next”. This statement basically promises that an error will not terminate execution. Check the error number to see if any errors have occurred and take the appropriate action. Finally, to turn off error handling, use “on error goto 0”. Using this technique around the trouble spots in your code can help you avoid unexpected runtime errors.

  0 then  response.write "Let's handle the error!"end ifon error goto 0Response.Write 1/0%>


Share the Post: