Wednesday, May 2, 2012

Output from an Exception class in App_Code

I am trying to see what exception is happening on my dev clients devserver (our servers are fine) and I have an TestException.cs class that handles the most of my exceptions from my sql statement class.



I have a method like so:



StringBuilder errorMessages = new StringBuilder();

for (int i = 0; i < innerException.Errors.Count; i++)
{
errorMessages.Append("Index #" + i + "\n" +
"Message: " + innerException.Errors[i].Message + "\n" +
"LineNumber: " + innerException.Errors[i].LineNumber + "\n" +
"Source: " + innerException.Errors[i].Source + "\n" +
"Procedure: " + innerException.Errors[i].Procedure + "\n");
}

//Console.WriteLine(errorMessages.ToString());
Response.Clear();
Response.Write("FAILURE");
Response.End();


But the Response.XX won't compile and if I use console.writeline when it hits it on the client server, the browser gets a connection lost webpage.



Is there a better way to do this?





No comments:

Post a Comment