473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Stacktrace with line numbers

Hi,
I'm trying to implement a custom error page for testing purposes.
When an error occurs, I catch it in the global.asax and store it in a
session object, so that the custom error page can display it.
so far so good.
my problem is, that i would like to have a detailed error message like the
standard asp.net error message with line numbers etc. At the moment i'm just
getting the methods called...
This is the code I'm using:
sb.Append("<br>Stacktrace ")
sb.Append("<br>" + ex.StackTrace.Replace(System.Environment.NewLine,
"<br>"))
sb.Append("<br>")
sb.Append("<br>Error")
sb.Append("<br>" + ex.ToString().Replace(System.Environment.NewLine,
"<br>"))
sb.Append("<br>")

Any ideas??
Thanks and Regards
Karsten
Nov 17 '05 #1
1 1813
Try Environment.StackTrace()

Tommy,

"Karsten Grombach" <ka****************@spamtria.de> wrote in message news:<#z**************@TK2MSFTNGP10.phx.gbl>...
Hi,
I'm trying to implement a custom error page for testing purposes.
When an error occurs, I catch it in the global.asax and store it in a
session object, so that the custom error page can display it.
so far so good.
my problem is, that i would like to have a detailed error message like the
standard asp.net error message with line numbers etc. At the moment i'm just
getting the methods called...
This is the code I'm using:
sb.Append("<br>Stacktrace ")
sb.Append("<br>" + ex.StackTrace.Replace(System.Environment.NewLine,
"<br>"))
sb.Append("<br>")
sb.Append("<br>Error")
sb.Append("<br>" + ex.ToString().Replace(System.Environment.NewLine,
"<br>"))
sb.Append("<br>")

Any ideas??
Thanks and Regards
Karsten

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Will Ware | last post by:
I was fooling with some Python code, and starting to miss the Exception.printStackTrace() feature in Java. Here is a stab at something roughly analogous, which puts together a stacktrace as an XML...
14
by: Vlad | last post by:
Please consider this code public class MyClass{ public bool MyMethod1(){ return false; } public bool MyMethod2(){ int x=0,y=1/x; return false; }
4
by: Barry Mossman | last post by:
Hi, I am throwing an exception derived from ApplicationException as follows catch (Exception ex) { throw new MyException("message", ex); } My exception's constructor is: public...
2
by: Avinash | last post by:
Hi, I am facing problem with the use of the stackframe and stacktrace for the exception hadling with Windows service. Can any one please tell me how to use of the above objects (stackframe and...
3
by: Kurt Biesemans | last post by:
Hello, I have a line code : StackTrace stackTrace = new StackTrace(false); When I run the project in debug, the application keeps hanging on this line. My Environment: Windows 2003 Server...
0
by: lajo_79 | last post by:
my service has a functions that gets triggered by a timer.. my code catches a nullref exception but i cant get the stacktrace for it... i only get information about which function that generated...
0
by: Kieran Toon | last post by:
I'm using Visual Studio 2005 and have an ASP.NET web application written in Visual Basic. When the application runs on my local webserver and hits an error, my errorhandler writes out debug...
5
by: Dan | last post by:
Hi. I've noticed that, when I build an exe in release mode (as opposed to debug mode), the StackTrace for exception does not include line numbers. Is there a way that I can build in release mode...
6
by: Kristijan Marin | last post by:
Hi, Can please anyone tell me why do i get only the first method in which the exception was thrown and not the line that triggered the exception ? I don't know if I set something in VS2005 wrong...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.