Solved

Formatting Error Stack Trace

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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