Solved

Formatting Error Stack Trace

Posted on 2007-03-20
1
245 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 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