Using Error Msg box on website

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

Guest

I am working on a web project (web-site) in Visual Studio 2005 in the C#
language and want to bring up a sort of error message window as part of my
try and catch blocks on certain parts of my code. At the moment just using
the basic Console.Writeline to output the Exception's message (which as you
can imagine is not much use on a Website!!). Please can someone show me the
basic code to output a window or a form with the error message from a try and
catch statement please..
 
Makaveli said:
I am working on a web project (web-site) in Visual Studio 2005 in the C#
language and want to bring up a sort of error message window as part of my
try and catch blocks on certain parts of my code. At the moment just using
the basic Console.Writeline to output the Exception's message (which as
you
can imagine is not much use on a Website!!). Please can someone show me
the
basic code to output a window or a form with the error message from a try
and
catch statement please..

EventLog.WriteEntry to save the error information where only the server
admin can see it.

Response.Redirect to send your user to an "internal failure, call support"
page.
 
A web application is quite a bit different from a Windows app. When the
browser hits the site, the site just respond with some output. You could
just write at a particular place in the current page being build (or use
client side JS to display a message box when this page loads or discard the
output and display a generic error page depending on what exactly you have
caught).

I would start by having a global error handler (see global.asax in the
documentation) that displays a generic message. This handler can mail the
error details to support staff.
 
Back
Top