Solved

Error handling, Server.GetLastError()

Posted on 2003-11-10
1
860 Views
Last Modified: 2012-05-04
Hi

I am trying to get more detailed error information using Server.GetLastError(), I see on the web that one can retreive this stuff:

.ASPCode
.Number
.Source
.File
.Line

However this does not work for me, I can only get this stuff and want the above goodies.

.Message
.StackTrace
.Source

please help, do I have a wrong version of .net framework or something?
0
Comment
Question by:iqula
1 Comment
 
LVL 23

Accepted Solution

by:
naveenkohli earned 125 total points
Comment Utility
You already have this information. StackTrace will help you to get to the file name and line number. Take a look at this code snippet from documentation.

Public Shared Sub Main()

        Try
            Dim sts As New StackTraceSample()
            sts.MyPublicSub()
        Catch
            ' Create a StackTrace that does not capture filename, line number or column information.
            Dim strace As New StackTrace()
            Dim count As Integer

            ' High up the call stack, there is only one stack frame
            While count < strace.FrameCount
                Dim frame As New StackFrame()
                frame = strace.GetFrame(count)
                Console.WriteLine("High Up the Call Stack, Method: {0}", frame.GetMethod())
                Console.WriteLine("High Up the Call Stack, Line Number: {0}", frame.GetFileLineNumber())
                count = count + 1
            End While

        End Try

    End Sub
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Query datatable in LINQ 6 39
Text in tooltip bound field bridview 3 29
Code enhancement 5 12
c# if statement weird reaction 3 28
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now