Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

Try-Catch error handling


I would like for a page in my app (asp.net framework 2.0, VS 2005) to
both display a message to the user, as well as sending an email when an
error occurs.

I have code in the global.asax.vb codefile to generate an email when an
application error occurs, but is there a way to send an email to me when
this particular page has some sort of a SQL read error (or something
similar)?

I don't want to end the application, I would just like to throw a
message into a label on the page, and have the user continue with the
application, perhaps instructing them to click on a "return" button to
go back to the main menu.

Thanks,

BC

I'd be careful putting too much code in your error handling.  I beleive the
server.scripttimeout is infinate after an error occured, so your thread could
hang for a long time waiting for the SMTP server.

Other than that, how about putting a try... catch ex as sqlException for
that particular page.  Then you keep how you want to handle exceptions on
that page local to the code on that page instead of putting it in global.

I have just done that. I catch serious errors on each form, storing the
information about the error, source and errorcode in a session var. Then I
redirect the user to an error form that just displays the error message in a
nice way, based on the session var. But also, this error form form sends an
email back to me; containing the userID, the part of the application and the
errormessage itself. Very useful, and quite simple.

Bjorn

"Blasting Cap" <goo@christian.net> wrote in message

news:%23Bs0bptoHHA.1240@TK2MSFTNGP06.phx.gbl...

Bjorn:

Did you have any examples of this code online?

Thanks,

BC

I guess what I am asking is there any way to supply the application with
the SMTP server name externally, like passing in a parameter name in a
config file that the app will pick up & be able to use across the
application?

BC

I am sure that can be done, even though I haven't done just that in VS 2005
yet.
To open a file and read the content shold be easy, something like declaring
a var as FileSystem, then open the deired file and read the content as text.

Bjorn

"Blasting Cap" <goo@christian.net> wrote in message

news:e4zubivoHHA.4192@TK2MSFTNGP06.phx.gbl...

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc