为什么不试试..在我的网页上工作? [英] Why doesn't try..catch work on my web page?

查看:58
本文介绍了为什么不试试..在我的网页上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么不尝试在我的asp.net页面上工作?


尝试

Dim n As Integer = 10
n = n / 0

Catch ex As Exception

''忽略错误

结束尝试


当我单步执行n = n / 0行时,它会直接进入标准的

ASP.NET错误页面。为什么不被TRY忽略?


谢谢,Rob。

解决方案

不是Exception类型?


-

Curt Christianson

网站&脚本: http://www.Darkfalz.com

博客: http://blog.Darkfalz.com

" Rob Nicholson <为RO *********** @ nospam-unforgettable.com>在消息中写道

新闻:em ************** @ TK2MSFTNGP09.phx.gbl ...

为什么不尝试..在我的asp.net页面上工作?

尝试
Dim n As Integer = 10
n = n / 0
Catch ex As Exception
''忽略错误
结束尝试

当我单步执行n = n / 0行时,它会直接进入标准的ASP.NET错误页面。为什么不被忽视?

谢谢,Rob。



>不属于Exception类型吗?


对不起,不明白。 VB客户端程序中的相同代码进入Catch

部分。


< BLOCKQUOTE>>不是Exception类型吗?


啊,是的,我这样做:-)我正在建立一个库函数,我已经创建了一个

对象/那个叫做Exception的类。将它更改为Catch ex As

System.Exception有效。


嗯,特别是当VB创建Catch ex时,它会抓到一个

键入Try< CR>时出现异常位。我想我会重命名我自己的例外

等级。


干杯,Rob。


Why doesn''t try..catch work on my asp.net page?

Try
Dim n As Integer = 10
n = n / 0
Catch ex As Exception
'' ignore error
End Try

When I single step over the n=n/0 line, it goes straight to the standard
ASP.NET error page. Why isn''t the TRY ignored?

Thanks, Rob.

解决方案

not of type Exception?

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Rob Nicholson" <ro***********@nospam-unforgettable.com> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...

Why doesn''t try..catch work on my asp.net page?

Try
Dim n As Integer = 10
n = n / 0
Catch ex As Exception
'' ignore error
End Try

When I single step over the n=n/0 line, it goes straight to the standard
ASP.NET error page. Why isn''t the TRY ignored?

Thanks, Rob.



> not of type Exception?

Sorry don''t understand. Same code in a VB client program goes into the Catch
section.

Thanks, Rob.


> not of type Exception?

Ahh, yes I do :-) I''m building a library function and I''ve created an
object/class in that called Exception. Changing it to Catch ex As
System.Exception worked.

Hmm, that''s going to catch one out especially as VB creates the Catch ex as
Exception bit when you type Try<CR>. I think I''ll rename my own exception
class.

Cheers, Rob.


这篇关于为什么不试试..在我的网页上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆