How to handle errors in server code

Discussion in 'ASP .Net' started by =?Utf-8?B?UmljaGFyZA==?=, Aug 6, 2007.

  1. 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
     
    =?Utf-8?B?UmljaGFyZA==?=, Aug 6, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?UmljaGFyZA==?=

    Mike Guest

    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.







    "Richard" <> wrote in message
    news:...
    > 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
    >
     
    Mike, Aug 7, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dietrich
    Replies:
    1
    Views:
    656
    Joe Smith
    Jul 22, 2004
  2. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    985
    Mark Goldin
    Jan 17, 2004
  3. Jonas

    Handle errors in global.asax

    Jonas, Nov 16, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    7,217
    Patrice
    Nov 17, 2005
  4. Leon
    Replies:
    2
    Views:
    544
  5. =?ISO-8859-1?Q?KLEIN_St=E9phane?=
    Replies:
    3
    Views:
    461
    hanumizzle
    Oct 6, 2006
Loading...

Share This Page