Solved

Formatting Error Stack Trace

Posted on 2007-03-20
1
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

617 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