Solved

Error handling, Server.GetLastError()

Posted on 2003-11-10
1
864 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
ID: 9715616
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
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…

809 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