For Programmers: Free Programming Magazines  


Home > Archive > MSDN > September 2005 > srever.GetLastError returns 0









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author srever.GetLastError returns 0
John

2005-09-29, 6:55 pm

I've written a custom error page based on
<%
' ...
Set objASPError = Server.GetLastError
' ...
Dim bakCodepage
on error resume next
bakCodepage = Session.Codepage
Session.Codepage = 1252
on error goto 0
Response.Write Server.HTMLEncode(objASPError.Category)
If objASPError.ASPCode > "" Then Response.Write Server.HTMLEncode(", " &
objASPError.ASPCode)
Response.Write Server.HTMLEncode(" (0x" & Hex(objASPError.Number) & ")" )
& "<br>"
If objASPError.ASPDescription > "" Then
Response.Write Server.HTMLEncode(objASPError.ASPDescription) & "<br>"
elseIf (objASPError.Description > "") Then
Response.Write Server.HTMLEncode(objASPError.Description) & "<br>"
end if
' ...
%>

and have used the standard IIS redirection to call this page when it
encounters a 500;100 error. The problem is that it always returns 0 as the
error code and no other info.
What am I doing wrong?
The server is running Windows 2003, not sure of the IIS version.
John

2005-09-30, 7:56 am

OK folks, forget this one, I've found out what was wrong!
John

"John" wrote:

> I've written a custom error page based on
> <%
> ' ...
> Set objASPError = Server.GetLastError
> ' ...
> Dim bakCodepage
> on error resume next
> bakCodepage = Session.Codepage
> Session.Codepage = 1252
> on error goto 0
> Response.Write Server.HTMLEncode(objASPError.Category)
> If objASPError.ASPCode > "" Then Response.Write Server.HTMLEncode(", " &
> objASPError.ASPCode)
> Response.Write Server.HTMLEncode(" (0x" & Hex(objASPError.Number) & ")" )
> & "<br>"
> If objASPError.ASPDescription > "" Then
> Response.Write Server.HTMLEncode(objASPError.ASPDescription) & "<br>"
> elseIf (objASPError.Description > "") Then
> Response.Write Server.HTMLEncode(objASPError.Description) & "<br>"
> end if
> ' ...
> %>
>
> and have used the standard IIS redirection to call this page when it
> encounters a 500;100 error. The problem is that it always returns 0 as the
> error code and no other info.
> What am I doing wrong?
> The server is running Windows 2003, not sure of the IIS version.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com