Forum Moderators: open

Message Too Old, No Replies

ASPError object

not working properly

         

joshie76

10:17 am on Jan 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to get some more information out of an ASP error and looked up some info on the ASPError object:

W3schools have an example on it's use here: [w3schools.com...]

However - I can't get it to work. If I run the example above 'as is' then the normal IIS error (HTTP 500.100 - Internal Server Error) file is opened.

If I add 'On error resume next' at the top? No improvement. Change the 'incorrect' line to cint("w") and then I get the screen as expected but all the error information is blank (the number is 0).

What am I doing wrong?

(Am using IIS5 on W2K)

<edit>removed request to be moved</edit>

Xoc

7:39 pm on Jan 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The description on that page isn't very good.

What you have to do is put this code into an servererror.asp page (extension is important):


<html>
<body>

<%
dim objerr
set objerr = Server.GetLastError()

'The variable objerr now contains the ASPError object
response.write("ASP Code=" & objerr.ASPCode)
response.write("<br />")
response.write("Number=" & objerr.Number)
response.write("<br />")
response.write("Source=" & objerr.Source)
response.write("<br />")
response.write("Filename=" & objerr.File)
response.write("<br />")
response.write("LineNumber=" & objerr.Line)
%>

</body>
</html>


Then you need to go into the IIS Manager dialogs and set the 500;100 error page to point to the servererror.asp file you just created.

Then create a separate .asp page that contains this:


<HTML>
<HEAD>
</HEAD>
<BODY>
<!--#include fil=inc.h -->
<%
dim I
for i=1 to 1
nxt
%>
<%
dim i,j
dim sum
sum=0
j=0

for i=1 to 10
sum=sum+1
next

sum=sum/j
%>
</BODY>
</HTML>


View this page in the browser. It should give you an error. There are three kinds of errors mentioned here [msdn.microsoft.com].