Simple, solution-wide error trap in VB.NET?

D

Doug

Found this thread, but code is C# (would rather have VB.NET).

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q306355

Can anyone point me to a simple solution? We don't want the error
codes appearing to the end-user, but obviously we want to be able to
log and e-mail them, etc.

According to what I've been reading, the way to accomplish this is to
change the "CustomErrors" mode and the 'defaultRedirect' in web.config,
rather than enclose every piece of code with "Try...Catch". Is this
correct?
 
M

Marina Levit [MVP]

There are a couple of other ways:

1. Define a BasePage class for all your pages to inherit from. In it,
handler the Error event and process appropriately.
2. Handle the Application_Error in global.asax, and process appropriately
 
D

Doug

I should add that we are using Visual Studio 2005 and SQL Server 2000.

Also, the C# example I cited earlier was designed for .Net 2002/2003.
 
D

Doug

Marina said:
There are a couple of other ways:

1. Define a BasePage class for all your pages to inherit from. In it,
handler the Error event and process appropriately.
2. Handle the Application_Error in global.asax, and process appropriately

Thank you. Is there still a global.asax in VS2005?

Also, I found the VB.NET equivalent of the C# example I cited above:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q308132

but it, too, references global.asax, which I don't see anymore in
VS2005.
 
P

Patrice

It still there. It's not added for you if you choosed to create an empty web
site. Just add an item , it should in the list...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top