How to handle errors in server code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

In my ASP.NET 2 page, there's Javascript code that uses XMLHttpRequest class
to execute code (which access the database) on the server, and sends data
back to populate controls on the page.

How should errors be handled in the server code, for example when a database
error occurrs?

Thanks in advance,

Rick
 
Use a try{} catch{} in your methods. The catch{} will get trap your errors
and you can write them out to a log file, to the page, a db table, etc, if
you want as well.
 
Back
Top