Beispiel #1
0
        private static string _renderStackRecordResultHtmlResponse(
            RenderingCollection preparedResult,
            string errorFileStr,
            string stackTraceStr,
            string headersStr,
            string dateStr
            )
        {
            string linkValue = "https://www.google.com/search?sourceid=desharp&gws_rd=us&q="
                               + HttpUtility.UrlEncode(preparedResult.ExceptionMessage);
            string causedByMsg = preparedResult.CausedByMessage;

            if (causedByMsg.Length > 50)
            {
                causedByMsg = causedByMsg.Substring(0, 50) + "...";
            }
            StringBuilder result = new StringBuilder();

            result
            .Append(@"<div class=""exception"">")
            .Append(@"<div class=""head"">")
            .Append(@"<div class=""type"">" + preparedResult.ExceptionType)
            .Append(!String.IsNullOrEmpty(preparedResult.ExceptionHash)
                            ? " (Hash Code: " + preparedResult.ExceptionHash + ")"
                            : "")
            .Append("</div>")
            .Append(@"<a href=""" + linkValue + @""" target=""_blank"">")
            .Append(preparedResult.ExceptionMessage)
            .Append("</a>")
            .Append(@"<div class=""info"">")
            .Append("Catched: " + (preparedResult.Catched ? "yes" : "no"))
            .Append(preparedResult.CausedByHash.Length > 0
                                                        ? ", Caused By: " + preparedResult.CausedByType + " (Hash Code: " + preparedResult.CausedByHash + ", Message: " + causedByMsg + ")"
                                                        : "")
            .Append("</div>")
            .Append("</div>")
            .Append(errorFileStr)
            .Append(stackTraceStr);
            if (preparedResult.Headers.Count > 0)
            {
                result.Append(Exceptions._renderHtmlDataTable("HTTP Headers:", headersStr));
            }
            result.Append(
                Exceptions._renderHtmlDataTable(
                    "Application Domain Assemblies:",
                    Exceptions._renderDataTableRows(LoadedAssemblies.CompleteLoadedAssemblies(), true, true)
                    )
                );
            result.Append(Exceptions._renderHtmlResponseFooterInfo());
            result.Append("</div>");
            return(result.ToString());
        }