Results 1 to 2 of 2

Thread: Server.GetLastError() in ASP

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2003
    Location
    C:\Windows\Microsoft.NET\Framework
    Posts
    574

    Server.GetLastError() in ASP

    I am just starting out on ASP and was trying to raise an Error and retrieve info about the error by making a call to the GetLastError function of the Server class, but instead what I get is the plain vanilla IE error reporting (see attachment for a picture of what my IE looks like when I run my code). Here's my code:

    Code:
    <%@ Language=VBScript%>
    
    <HTML>
    <%
    
    dim objErr
    Dim a
    
    a=5/0
    set objErr=Server.GetLastError()
    
    response.write("ASPCode=" & objErr.ASPCode)
    response.write("<br />")
    response.write("ASPDescription=" & objErr.ASPDescription)
    response.write("<br />")
    response.write("Category=" & objErr.Category)
    response.write("<br />")
    response.write("Column=" & objErr.Column)
    response.write("<br />")
    response.write("Description=" & objErr.Description)
    response.write("<br />")
    response.write("File=" & objErr.File)
    response.write("<br />")
    response.write("Line=" & objErr.Line)
    response.write("<br />")
    response.write("Number=" & objErr.Number)
    response.write("<br />")
    response.write("Source=" & objErr.Source)
    
    %>
    
    </HTML>
    Do I have to configure IIS to trap errors or something? I am using IE5 which I believe implements the ASPError object.
    Attached Files Attached Files

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Try setting GetLastError before the error occcurs...
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width