用Server.getLastError()的疑问

hehongyu2000 2001-11-22 08:28:15
为什么我用Server.getLastError()得到的ASPError对象属性值全是空或0.
win2000
IIS5
IE6.0
--------- Sample ---------------------------
<%@ Language=JavaScript %>
<%
try {
if (something == nothing) then //Error statement
}
catch(e) {
Response.write(Server.getLastError().ASPDescription()); //Show error description
}
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<P> </P>

</BODY>
</HTML>

...全文
145 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hehongyu2000 2001-11-24
  • 打赏
  • 举报
回复
continue
hehongyu2000 2001-11-24
  • 打赏
  • 举报
回复
to zcflion(土匪):
老大, 你做出来了吗, 可告诉我什么原因我出不来吗. Thanks.
zcflion 2001-11-24
  • 打赏
  • 举报
回复
当然可以就像hehongyu2000说的那样啊,可以直接用Server.GetLastError()来取得
hehongyu2000 2001-11-24
  • 打赏
  • 举报
回复
Frankly, the sample that I posted is a sample of "Programming Microsoft Windows 2000 Unleashed". If you have that book, you can review it. The sample in that book used try/catch to get ASPError. On the other hand, if I don't use try/catch to get error, how can I show the error message accoring to ASPError object. Thanks.

karma 2001-11-23
  • 打赏
  • 举报
回复
I think when you use try/catch, the error will be exposed through the parameter of catch(ex) and the ASPError object is cleared
hehongyu2000 2001-11-23
  • 打赏
  • 举报
回复
to karma(无为):
------------------------------
1:'something' is undefined
2:
3:
----------------------------
I have tried, above is the result.You see only your first line has error message, second and third have nothing. Do you have any idea about it.
I think there is some tricks. Because when a ASP existed error, IIS will call 500-100.asp to show detail error message, in 500-100.asp, Server.GetLastError() return a valid ASPError object. why I can't get the object myselect by call Server.GetLastError(). Thanks.
karma 2001-11-22
  • 打赏
  • 举报
回复
try

Response.write(e.description + "<br>");
Response.write(Server.GetLastError().Description + "<BR>");
Response.write(Server.GetLastError().ASPDescription);
hmbory 2001-11-22
  • 打赏
  • 举报
回复
关注!!!

帮你up一下:)

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧