Solved

Formatting Error Stack Trace

Posted on 2007-03-20
1
239 Views
Last Modified: 2010-04-16
Hi,

I'm trying to sned my error stack trace in an email. What I'm currently doing it literally string  str = e.StackTrace; and assigning str as the email body. It send ok. But there is no formatting to it and it's really tedious to read. I was wondering if anyone knows how I could format this so that it appears one line after another like it does in the runtime error. Thanks

0
Comment
Question by:bowemc
1 Comment
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 18755793
Are you sending HTML messages?  If so, use this:

    private static string cleanHTML(string Html)
    {
        // Cleans the string for HTML friendly display

        if (Html == null || Html.Length == 0)
            return "";
        return HttpUtility.HtmlEncode(Html).Replace("\r\n", "<BR>").Replace(" ", "&nbsp;");
    }

and in your error code use string str = cleanHTML(e.StackTrace);
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

11 Experts available now in Live!

Get 1:1 Help Now