473,408 Members | 2,839 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,408 software developers and data experts.

Geting Source Code from Exception.

I have a web application which has a custom error handler
which displays frendly message to user and emails me the
details.

The standard Asp.NET error handler page will, if the
project is in debug mode, display the line of code that
the error occoured on, as well as the previous and next 3
lines.

I would realy like to put this info in to the email that I
send to myself.

I think it might start with Excepition.TargetSite.
..
Nov 15 '05 #1
2 1112
Gary,

I think that what you want to do is use the StackTrace instance which is
exposed by the exception thrown. You can then call ToString to get the code
that caused the error, I believe.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot)paldino=at=exisconsulting<dot>com

"Gary van der Merwe" <ga*****@hotmail.com> wrote in message
news:0d****************************@phx.gbl...
I have a web application which has a custom error handler
which displays frendly message to user and emails me the
details.

The standard Asp.NET error handler page will, if the
project is in debug mode, display the line of code that
the error occoured on, as well as the previous and next 3
lines.

I would realy like to put this info in to the email that I
send to myself.

I think it might start with Excepition.TargetSite.
.

Nov 15 '05 #2
Ha I figered out how they (std ASP.Net Error Page) do it -
not what I was hopeing though.

They read the code from the file. They get the file name
and line number from the stack trace. If file name of the
first Stack Frame is not availible, it looks for the
second, ect..

I concluded this by renaming the file that the exception
was been thrown in. It then showed the code for the class
that the method was called by.

I was realy hoping that the code was stored in the PDB
file, and that I could access it somehow.

Gary.
-----Original Message-----
Gary,

I think that what you want to do is use the StackTrace instance which isexposed by the exception thrown. You can then call ToString to get the codethat caused the error, I believe.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nick(dot) paldino=at=exisconsulting<dot>com
"Gary van der Merwe" <ga*****@hotmail.com> wrote in messagenews:0d****************************@phx.gbl...
I have a web application which has a custom error handler which displays frendly message to user and emails me the
details.

The standard Asp.NET error handler page will, if the
project is in debug mode, display the line of code that
the error occoured on, as well as the previous and next 3 lines.

I would realy like to put this info in to the email that I send to myself.

I think it might start with Excepition.TargetSite.
.

.

Nov 15 '05 #3

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

Similar topics

0
by: Monica Ferrero | last post by:
Hi! I'm not sure if this is the most adequate mySQL list for this post. If not, please indicat me which one I should use... I'm using Tomcat 4.1.24 with Apache 2 and MySQL 4.0.13. I have the...
3
by: Matik | last post by:
Hello everyone, I was wondering. Is it possible, to recive an event from ActiveX into database? I was looking alredy with notification services, but I think that's the wrong way. Lets say,...
0
by: Sonu Kapoor | last post by:
I tried the code and it works without any probs. The prob must be in your network. Maybe you have to reconfigure your Firwall. Sonu http://weblogs.asp.net/sonukapoor/ >-----Original...
5
by: Pavils Jurjans | last post by:
Hello, I have to debug an ASP.NET project which is hosted on the remote server, and it is not possible to achieve the same environment on localhost. So, I need to debug on the remote site....
14
by: Satheesh Babu B | last post by:
hai.. am having a checkboxlist..now how do i get the value of the checkbox that is checked in checkboxlist using javascript? Thanks in advance.... Regards,
0
by: Greg | last post by:
My app makes a call to a remote server (about which I know relatively little) using Webclient.UploadData. This is done once every 51/2 mins and is called by code within a worker thread. 95% of the...
3
by: Adam Sandler | last post by:
Hello all, I'm trying to use VWD 2005 Express Edition to connect to a database. For my initial prototyping though, I'm just using an Excel spreadsheet as the source and everything resides on the...
3
by: samtilden | last post by:
During my code's processing of an exception, I would like to format the exception myself. I can get almost everything (I can get exception itself, stack trace, file name, line number, method,...
6
by: ofiras | last post by:
Hii everyone, Dose someone knows if and how I can access internet urls? Can I get the source code of the page to a string variable? For example: There is a website www.hahaha.com, and it has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.