Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

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

瀏覽次數:11 次
跳到第一則未讀訊息

Doug

未讀,
2006年6月13日 上午11:21:382006/6/13
收件者:
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?

Doug

未讀,
2006年6月13日 上午11:43:222006/6/13
收件者:
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.

Marina Levit [MVP]

未讀,
2006年6月13日 上午11:41:212006/6/13
收件者:
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

"Doug" <spam...@gmail.com> wrote in message
news:1150212098....@f14g2000cwb.googlegroups.com...

Doug

未讀,
2006年6月13日 中午12:01:422006/6/13
收件者:
Marina Levit [MVP] wrote:
> 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.

Patrice

未讀,
2006年6月13日 下午1:23:402006/6/13
收件者:
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...

--
Patrice

"Doug" <spam...@gmail.com> a écrit dans le message de news:
1150214502.7...@c74g2000cwc.googlegroups.com...

Doug

未讀,
2006年7月3日 下午5:09:012006/7/3
收件者:
Marina Levit [MVP] wrote:
> 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.

Can you take a look at this thread and help me figure out what to do
next to implement this?

http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_frm/thread/82b963fca65314a8/644bfe5b8015aaa8?hl=en#644bfe5b8015aaa8

Thanks.

0 則新訊息