コード例 #1
0
 static void FormatSource(StringBuilder builder, StringBuilder longVersion, HtmlizedException e)
 {
     if (e is CompilationException)
     {
         WriteCompilationSource(builder, longVersion, e);
     }
     else
     {
         WritePageSource(builder, e);
     }
 }
コード例 #2
0
        static void FormatSource(StringBuilder builder, StringBuilder longVersion, HtmlizedException e)
        {
#if !TARGET_J2EE
            if (e is CompilationException)
            {
                WriteCompilationSource(builder, longVersion, e);
            }
            else
#endif
            WritePageSource(builder, e);
        }
コード例 #3
0
ファイル: HttpException.cs プロジェクト: raj581/Marvin
        static void WriteSource(StringBuilder builder, StringBuilder longVersion, HtmlizedException e)
        {
            builder.Append("<code><pre>");
            if (e is CompilationException)
            {
                WriteCompilationSource(builder, longVersion, e);
            }
            else
            {
                WritePageSource(builder, e);
            }

            builder.Append("<code></pre>\r\n");
        }
コード例 #4
0
ファイル: HttpException.cs プロジェクト: raj581/Marvin
        static void WritePageSource(StringBuilder builder, HtmlizedException e)
        {
            string s;
            int    line       = 0;
            int    beginerror = e.ErrorLines [0];
            int    enderror   = e.ErrorLines [1];
            int    begin      = beginerror - 2;
            int    end        = enderror + 2;

            if (begin <= 0)
            {
                begin = 1;
            }

            TextReader reader = new StringReader(e.FileText);

            while ((s = reader.ReadLine()) != null)
            {
                line++;
                if (line < begin)
                {
                    continue;
                }

                if (line > end)
                {
                    break;
                }

                if (beginerror == line)
                {
                    builder.Append("<span style=\"color: red\">");
                }

                builder.AppendFormat("Line {0}: {1}\r\n", line, HtmlEncode(s));

                if (enderror <= line)
                {
                    builder.Append("</span>");
                    enderror = end + 1;                     // one shot
                }
            }
        }
コード例 #5
0
        public string GetHtmlErrorMessage()
        {
            try
            {
                HttpContext ctx = HttpContext.Current;
                if (ctx != null && ctx.IsCustomErrorEnabled)
                {
                    if (http_code != 404 && http_code != 403)
                    {
                        return(GetCustomErrorDefaultMessage());
                    }
                    else
                    {
                        return(GetDefaultErrorMessage(false, null));
                    }
                }

                Exception ex = GetBaseException();
                if (ex == null)
                {
                    ex = this;
                }

                HtmlizedException htmlException = ex  as HtmlizedException;
                if (htmlException == null)
                {
                    return(GetDefaultErrorMessage(true, ex));
                }

                return(GetHtmlizedErrorMessage(htmlException));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);

                // we need the try/catch block in case the
                // problem was with MapPath, which will cause
                // IsCustomErrorEnabled to throw an exception
                return(GetCustomErrorDefaultMessage());
            }
        }
コード例 #6
0
		static void WriteCompilationSource (StringBuilder builder, HtmlizedException e)
		{
			int [] a = e.ErrorLines;
			string s;
			int line = 0;
			int index = 0;
			int errline = 0;

			if (a != null && a.Length > 0)
				errline = a [0];
			
			TextReader reader = new StringReader (e.FileText);
			while ((s = reader.ReadLine ()) != null) {
				line++;

				if (errline == line)
					builder.Append ("<span style=\"color: red\">");

				builder.AppendFormat ("Line {0}: {1}\r\n", line, HtmlEncode (s));

				if (line == errline) {
					builder.Append ("</span>");
					errline = (++index < a.Length) ? a [index] : 0;
				}
			}
		}
コード例 #7
0
ファイル: HttpException.cs プロジェクト: raj581/Marvin
        static void WriteCompilationSource(StringBuilder builder, StringBuilder longVersion, HtmlizedException e)
        {
            int [] a = e.ErrorLines;
            string s;
            int    line    = 0;
            int    index   = 0;
            int    errline = 0;

            if (a != null && a.Length > 0)
            {
                errline = a [0];
            }

            int begin = errline - 2;
            int end   = errline + 2;

            if (begin < 0)
            {
                begin = 0;
            }

            string tmp;

            using (TextReader reader = new StringReader(e.FileText)) {
                while ((s = reader.ReadLine()) != null)
                {
                    line++;
                    if (line < begin || line > end)
                    {
                        if (longVersion != null)
                        {
                            longVersion.AppendFormat("Line {0}: {1}\r\n", line, HtmlEncode(s));
                        }
                        continue;
                    }

                    if (errline == line)
                    {
                        if (longVersion != null)
                        {
                            longVersion.Append("<span style=\"color: red\">");
                        }
                        builder.Append("<span style=\"color: red\">");
                    }

                    tmp = String.Format("Line {0}: {1}\r\n", line, HtmlEncode(s));
                    builder.Append(tmp);
                    if (longVersion != null)
                    {
                        longVersion.Append(tmp);
                    }

                    if (line == errline)
                    {
                        builder.Append("</span>");
                        if (longVersion != null)
                        {
                            longVersion.Append("</span>");
                        }
                        errline = (++index < a.Length) ? a [index] : 0;
                    }
                }
            }
        }
コード例 #8
0
ファイル: HttpException.cs プロジェクト: kumpera/mono
		static void FormatSource (StringBuilder builder, StringBuilder longVersion, HtmlizedException e)
		{
#if !TARGET_J2EE
			if (e is CompilationException)
				WriteCompilationSource (builder, longVersion, e);
			else
#endif
				WritePageSource (builder, e);
		}
コード例 #9
0
ファイル: HttpException.cs プロジェクト: raj581/Marvin
 static void WriteSource(StringBuilder builder, StringBuilder longVersion, HtmlizedException e)
 {
     builder.Append("<code><pre>");
     WritePageSource(builder, e);
     builder.Append("</code></pre>\r\n");
 }
コード例 #10
0
ファイル: HttpException.cs プロジェクト: raj581/Marvin
        string GetHtmlizedErrorMessage(HtmlizedException exc)
        {
            StringBuilder builder = new StringBuilder();

#if TARGET_J2EE
            bool isParseException   = false;
            bool isCompileException = false;
#else
            bool isParseException   = exc is ParseException;
            bool isCompileException = (!isParseException && exc is CompilationException);
#endif

            WriteFileTop(builder, exc.Title);
            builder.AppendFormat("<h2><em>{0}</em></h2>\r\n", exc.Title);
            builder.AppendFormat("<p><strong>Description: </strong>{0}\r\n</p>\r\n", HtmlEncode(exc.Description));
            string errorMessage = HtmlEncode(exc.ErrorMessage);

            builder.Append("<p><strong>");
            if (isParseException)
            {
                builder.Append("Parser ");
            }
            else if (isCompileException)
            {
                builder.Append("Compiler ");
            }

            builder.Append("Error Message: </strong>");
#if NET_2_0
            builder.AppendFormat("<code>{0}</code></p>", errorMessage);
#else
            builder.AppendFormat("<blockquote><pre>{0}</pre></blockquote></p>", errorMessage);
#endif

            StringBuilder longCodeVersion = null;

            if (exc.FileText != null)
            {
                if (isParseException || isCompileException)
                {
                    builder.Append("<p><strong>Source Error: </strong></p>\r\n");
                    builder.Append("<table summary=\"Source error\" class=\"sampleCode\">\r\n<tr><td>");

                    if (isCompileException)
                    {
                        longCodeVersion = new StringBuilder();
                    }
                    WriteSource(builder, longCodeVersion, exc);
                    builder.Append("</pre></code></td></tr>\r\n</table>\r\n");
                }
                else
                {
                    builder.Append("<table summary=\"Source file\" class=\"sampleCode\">\r\n<tr><td>");
                    WriteSource(builder, null, exc);
                    builder.Append("</pre></code></td></tr>\r\n</table>\r\n");
                }

                builder.Append("<br/><p><strong>Source File: </strong>");
                if (exc.SourceFile != exc.FileName)
                {
                    builder.Append(FormatSourceFile(exc.SourceFile));
                }
                else
                {
                    builder.Append(FormatSourceFile(exc.FileName));
                }

                if (isParseException || isCompileException)
                {
                    int[] errorLines = exc.ErrorLines;
                    int   numErrors  = errorLines != null ? errorLines.Length : 0;
                    if (numErrors > 0)
                    {
                        builder.AppendFormat("&nbsp;&nbsp;<strong>Line{0}: </strong>", numErrors > 1 ? "s" : String.Empty);
                        for (int i = 0; i < numErrors; i++)
                        {
                            if (i > 0)
                            {
                                builder.Append(", ");
                            }
                            builder.Append(exc.ErrorLines [i]);
                        }
                    }
                }
                builder.Append("</p>");
            }
            else if (exc.FileName != null)
            {
                builder.AppendFormat("{0}</p>", HtmlEncode(exc.FileName));
            }

            bool needToggleJS = false;

#if !TARGET_J2EE
            if (isCompileException)
            {
                CompilationException cex    = exc as CompilationException;
                StringCollection     output = cex.CompilerOutput;

                if (output != null && output.Count > 0)
                {
                    needToggleJS = true;
                    StringBuilder sb = new StringBuilder();
                    foreach (string s in output)
                    {
                        sb.Append(s + "\r\n");
                    }
                    WriteExpandableBlock(builder, "compilerOutput", "Show Detailed Compiler Output", sb.ToString());
                }
            }
#endif

            if (longCodeVersion != null && longCodeVersion.Length > 0)
            {
                WriteExpandableBlock(builder, "fullCode", "Show Complete Compilation Source", longCodeVersion.ToString());
                needToggleJS = true;
            }

            if (needToggleJS)
            {
                builder.Append("<script type=\"text/javascript\">\r\n" +
                               "function ToggleVisible (id)\r\n" +
                               "{\r\n" +
                               "\tvar e = document.getElementById (id);\r\n" +
                               "\tif (e.style.display == 'none')\r\n" +
                               "\t{\r\n" +
                               "\t\te.style.display = '';\r\n" +
                               "\t} else {\r\n" +
                               "\t\te.style.display = 'none';\r\n" +
                               "\t}\r\n" +
                               "}\r\n" +
                               "</script>\r\n");
            }

            WriteFileBottom(builder, true);

            return(builder.ToString());
        }
コード例 #11
0
ファイル: HttpException.cs プロジェクト: stabbylambda/mono
		string GetHtmlizedErrorMessage (HtmlizedException exc)
		{
			StringBuilder builder = new StringBuilder ();
#if TARGET_J2EE
			bool isParseException = false;
			bool isCompileException = false;
#else
			bool isParseException = exc is ParseException;
			bool isCompileException = (!isParseException && exc is CompilationException);
#endif
			
			WriteFileTop (builder, exc.Title);
			builder.AppendFormat ("<h2><em>{0}</em></h2>\r\n", exc.Title);
			builder.AppendFormat ("<p><strong>Description: </strong>{0}\r\n</p>\r\n", HtmlEncode (exc.Description));
			string errorMessage = HtmlEncode (exc.ErrorMessage);
			
			builder.Append ("<p><strong>");
			if (isParseException)
				builder.Append ("Parser ");
			else if (isCompileException)
				builder.Append ("Compiler ");
			
			builder.Append ("Error Message: </strong>");
			builder.AppendFormat ("<code>{0}</code></p>", errorMessage);

			StringBuilder longCodeVersion = null;
			
			if (exc.FileText != null) {
				if (isParseException || isCompileException) {
					builder.Append ("<p><strong>Source Error: </strong></p>\r\n");
					builder.Append ("<table summary=\"Source error\" class=\"sampleCode\">\r\n<tr><td>");

					if (isCompileException)
						longCodeVersion = new StringBuilder ();
					WriteSource (builder, longCodeVersion, exc);
					builder.Append ("</pre></code></td></tr>\r\n</table>\r\n");
				} else {
					builder.Append ("<table summary=\"Source file\" class=\"sampleCode\">\r\n<tr><td>");
					WriteSource (builder, null, exc);
					builder.Append ("</pre></code></td></tr>\r\n</table>\r\n");
				}

				builder.Append ("<br/><p><strong>Source File: </strong>");
				if (exc.SourceFile != exc.FileName)
					builder.Append (FormatSourceFile (exc.SourceFile));
				else
					builder.Append (FormatSourceFile (exc.FileName));

				if (isParseException || isCompileException) {
					int[] errorLines = exc.ErrorLines;
					int numErrors = errorLines != null ? errorLines.Length : 0;
					if (numErrors > 0) {
						builder.AppendFormat ("&nbsp;&nbsp;<strong>Line{0}: </strong>", numErrors > 1 ? "s" : String.Empty);
						for (int i = 0; i < numErrors; i++) {
							if (i > 0)
								builder.Append (", ");
							builder.Append (exc.ErrorLines [i]);
						}
					}
				}
				builder.Append ("</p>");
			} else if (exc.FileName != null)
				builder.AppendFormat ("{0}</p>", HtmlEncode (exc.FileName));

			bool needToggleJS = false;
			
#if !TARGET_J2EE
			if (isCompileException) {
				CompilationException cex = exc as CompilationException;
				StringCollection output = cex.CompilerOutput;

				if (output != null && output.Count > 0) {
					needToggleJS = true;
					StringBuilder sb = new StringBuilder ();
					foreach (string s in output)
						sb.Append (s + "\r\n");
					WriteExpandableBlock (builder, "compilerOutput", "Show Detailed Compiler Output", sb.ToString ());
				}
			}
#endif
			
			if (longCodeVersion != null && longCodeVersion.Length > 0) {
				WriteExpandableBlock (builder, "fullCode", "Show Complete Compilation Source", longCodeVersion.ToString ());
				needToggleJS = true;
			}

			if (needToggleJS)
				builder.Append ("<script type=\"text/javascript\">\r\n" +
						"function ToggleVisible (id)\r\n" +
						"{\r\n" +
						"\tvar e = document.getElementById (id);\r\n" +
						"\tif (e.style.display == 'none')\r\n" +
						"\t{\r\n" +
						"\t\te.style.display = '';\r\n" +
						"\t} else {\r\n" +
						"\t\te.style.display = 'none';\r\n" +
						"\t}\r\n" +
						"}\r\n" +
						"</script>\r\n");
			
			WriteFileBottom (builder, true);
			
			return builder.ToString ();
		}
コード例 #12
0
        void FillHtmlizedErrorValues(ExceptionPageTemplateValues values, HtmlizedException exc, ref ExceptionPageTemplateType pageType)
        {
            bool isParseException   = exc is ParseException;
            bool isCompileException = (!isParseException && exc is CompilationException);

            values.Add(ExceptionPageTemplate.Template_PageTitleName, HtmlEncode(exc.Title));
            values.Add(ExceptionPageTemplate.Template_DescriptionName, HtmlEncode(exc.Description));
            values.Add(ExceptionPageTemplate.Template_StackTraceName, HtmlEncode(exc.StackTrace));
            values.Add(ExceptionPageTemplate.Template_ExceptionTypeName, exc.GetType().ToString());
            values.Add(ExceptionPageTemplate.Template_ExceptionMessageName, HtmlEncode(exc.Message));
            values.Add(ExceptionPageTemplate.Template_DetailsName, HtmlEncode(exc.ErrorMessage));

            string origin;

            if (isParseException)
            {
                origin = "Parser";
            }
            else if (isCompileException)
            {
                origin = "Compiler";
            }
            else
            {
                origin = "Other";
            }
            values.Add(ExceptionPageTemplate.Template_HtmlizedExceptionOriginName, origin);
            if (exc.FileText != null)
            {
                pageType |= ExceptionPageTemplateType.SourceError;
                StringBuilder shortSource = new StringBuilder();
                StringBuilder longSource;

                if (isCompileException)
                {
                    longSource = new StringBuilder();
                }
                else
                {
                    longSource = null;
                }
                FormatSource(shortSource, longSource, exc);
                values.Add(ExceptionPageTemplate.Template_HtmlizedExceptionShortSourceName, shortSource.ToString());
                values.Add(ExceptionPageTemplate.Template_HtmlizedExceptionLongSourceName, longSource != null ? longSource.ToString() : null);

                if (exc.SourceFile != exc.FileName)
                {
                    values.Add(ExceptionPageTemplate.Template_HtmlizedExceptionSourceFileName, FormatSourceFile(exc.SourceFile));
                }
                else
                {
                    values.Add(ExceptionPageTemplate.Template_HtmlizedExceptionSourceFileName, FormatSourceFile(exc.FileName));
                }
                if (isParseException || isCompileException)
                {
                    int[] errorLines = exc.ErrorLines;
                    int   numErrors  = errorLines != null ? errorLines.Length : 0;
                    var   lines      = new StringBuilder();
                    for (int i = 0; i < numErrors; i++)
                    {
                        if (i > 0)
                        {
                            lines.Append(", ");
                        }
                        lines.Append(errorLines [i]);
                    }
                    values.Add(ExceptionPageTemplate.Template_HtmlizedExceptionErrorLinesName, lines.ToString());
                }
            }
            else
            {
                values.Add(ExceptionPageTemplate.Template_HtmlizedExceptionSourceFileName, FormatSourceFile(exc.FileName));
            }

            if (isCompileException)
            {
                CompilationException cex    = exc as CompilationException;
                StringCollection     output = cex.CompilerOutput;

                if (output != null && output.Count > 0)
                {
                    pageType |= ExceptionPageTemplateType.CompilerOutput;
                    var  sb    = new StringBuilder();
                    bool first = true;
                    foreach (string s in output)
                    {
                        sb.Append(HtmlEncode(s));
                        if (first)
                        {
                            sb.Append("<br/>");
                            first = false;
                        }
                        sb.Append("<br/>");
                    }

                    values.Add(ExceptionPageTemplate.Template_HtmlizedExceptionCompilerOutputName, sb.ToString());
                }
            }
        }
コード例 #13
0
        public string GetHtmlErrorMessage()
        {
            var values = new ExceptionPageTemplateValues();
            ExceptionPageTemplate template = PageTemplate;

            try {
                values.Add(ExceptionPageTemplate.Template_RuntimeVersionInformationName, RuntimeHelpers.MonoVersion);
                values.Add(ExceptionPageTemplate.Template_AspNetVersionInformationName, Environment.Version.ToString());

                HttpContext ctx = HttpContext.Current;
                ExceptionPageTemplateType pageType = ExceptionPageTemplateType.Standard;

                if (ctx != null && ctx.IsCustomErrorEnabled)
                {
                    if (http_code != 404 && http_code != 403)
                    {
                        FillDefaultCustomErrorValues(values);
                        pageType = ExceptionPageTemplateType.CustomErrorDefault;
                    }
                    else
                    {
                        FillDefaultErrorValues(false, false, null, values);
                    }
                }
                else
                {
                    Exception ex = GetBaseException();
                    if (ex == null)
                    {
                        ex = this;
                    }

                    values.Add(ExceptionPageTemplate.Template_FullStackTraceName, FormatFullStackTrace());
                    HtmlizedException htmlException = ex as HtmlizedException;
                    if (htmlException == null)
                    {
                        FillDefaultErrorValues(true, true, ex, values);
                    }
                    else
                    {
                        pageType = ExceptionPageTemplateType.Htmlized;
                        FillHtmlizedErrorValues(values, htmlException, ref pageType);
                    }
                }

                return(template.Render(values, pageType));
            } catch (Exception ex) {
                Console.Error.WriteLine("An exception has occurred while generating HttpException page:");
                Console.Error.WriteLine(ex);
                Console.Error.WriteLine();
                Console.Error.WriteLine("The actual exception which was being reported was:");
                Console.Error.WriteLine(this);

                // we need the try/catch block in case the
                // problem was with MapPath, which will cause
                // IsCustomErrorEnabled to throw an exception
                try {
                    FillDefaultCustomErrorValues(values);
                    return(template.Render(values, ExceptionPageTemplateType.CustomErrorDefault));
                } catch {
                    return(DoubleFaultExceptionMessage);
                }
            }
        }
コード例 #14
0
		static void WritePageSource (StringBuilder builder, HtmlizedException e)
		{
			string s;
			int line = 0;
			int beginerror = e.ErrorLines [0];
			int enderror = e.ErrorLines [1];
			int begin = beginerror - 3;
			int end = enderror + 3;
			if (begin <= 0)
				begin = 1;
			
			TextReader reader = new StringReader (e.FileText);
			while ((s = reader.ReadLine ()) != null) {
				line++;
				if (line < begin)
					continue;

				if (line > end)
					break;

				if (beginerror == line)
					builder.Append ("<span style=\"color: red\">");

				builder.AppendFormat ("{0}\r\n", HtmlEncode (s));

				if (enderror <= line) {
					builder.Append ("</span>");
					enderror = end + 1; // one shot
				}
			}
		}
コード例 #15
0
		static void WriteSource (StringBuilder builder, HtmlizedException e)
		{
			builder.Append ("<code><pre>");
			if (e is CompilationException)
				WriteCompilationSource (builder, e);
			else
				WritePageSource (builder, e);

			builder.Append ("</pre></code>\r\n");
		}
コード例 #16
0
		static void WriteSource (StringBuilder builder, HtmlizedException e)
		{
			builder.Append ("<code><pre>");
			WritePageSource (builder, e);
			builder.Append ("</pre></code>\r\n");
		}
コード例 #17
0
ファイル: HttpException.cs プロジェクト: vargaz/mono
		static void WriteCompilationSource (StringBuilder builder, StringBuilder longVersion, HtmlizedException e)
		{
			int [] a = e.ErrorLines;
			string s;
			int line = 0;
			int index = 0;
			int errline = 0;

			if (a != null && a.Length > 0)
				errline = a [0];

			int begin = errline - 2;
			int end = errline + 2;

			if (begin < 0)
				begin = 0;

			string tmp;			
			using (TextReader reader = new StringReader (e.FileText)) {
				while ((s = reader.ReadLine ()) != null) {
					line++;
					if (line < begin || line > end) {
						if (longVersion != null)
							longVersion.AppendFormat ("{0}: {1}\r\n", line, HtmlEncode (s));
						continue;
					}
				
					if (errline == line) {
						if (longVersion != null)
							longVersion.Append ("<span class=\"sourceErrorLine\">");
						builder.Append ("<span class=\"sourceErrorLine\">");
					}
					
					tmp = String.Format ("{0}: {1}\r\n", line, HtmlEncode (s));
					builder.Append (tmp);
					if (longVersion != null)
						longVersion.Append (tmp);
					
					if (line == errline) {
						builder.Append ("</span>");
						if (longVersion != null)
							longVersion.Append ("</span>");
						errline = (++index < a.Length) ? a [index] : 0;
					}
				}
			}			
		}
コード例 #18
0
ファイル: HttpException.cs プロジェクト: vargaz/mono
		static void FormatSource (StringBuilder builder, StringBuilder longVersion, HtmlizedException e)
		{
			if (e is CompilationException)
				WriteCompilationSource (builder, longVersion, e);
			else
				WritePageSource (builder, e);
		}
コード例 #19
0
ファイル: HttpException.cs プロジェクト: vargaz/mono
		void FillHtmlizedErrorValues (ExceptionPageTemplateValues values, HtmlizedException exc, ref ExceptionPageTemplateType pageType)
		{
			bool isParseException = exc is ParseException;
			bool isCompileException = (!isParseException && exc is CompilationException);
			values.Add (ExceptionPageTemplate.Template_PageTitleName, HtmlEncode (exc.Title));
			values.Add (ExceptionPageTemplate.Template_DescriptionName, HtmlEncode (exc.Description));
			values.Add (ExceptionPageTemplate.Template_StackTraceName, HtmlEncode (exc.StackTrace));
			values.Add (ExceptionPageTemplate.Template_ExceptionTypeName, exc.GetType ().ToString ());
			values.Add (ExceptionPageTemplate.Template_ExceptionMessageName, HtmlEncode (exc.Message));
			values.Add (ExceptionPageTemplate.Template_DetailsName, HtmlEncode (exc.ErrorMessage));

			string origin;
			if (isParseException)
				origin = "Parser";
			else if (isCompileException)
				origin = "Compiler";
			else
				origin = "Other";
			values.Add (ExceptionPageTemplate.Template_HtmlizedExceptionOriginName, origin);
			if (exc.FileText != null) {
				pageType |= ExceptionPageTemplateType.SourceError;
				StringBuilder shortSource = new StringBuilder ();
				StringBuilder longSource;
				
				if (isCompileException)
					longSource = new StringBuilder ();
				else
					longSource = null;
				FormatSource (shortSource, longSource, exc);
				values.Add (ExceptionPageTemplate.Template_HtmlizedExceptionShortSourceName, shortSource.ToString ());
				values.Add (ExceptionPageTemplate.Template_HtmlizedExceptionLongSourceName, longSource != null ? longSource.ToString () : null);
				
				if (exc.SourceFile != exc.FileName)
					values.Add (ExceptionPageTemplate.Template_HtmlizedExceptionSourceFileName, FormatSourceFile (exc.SourceFile));
				else
					values.Add (ExceptionPageTemplate.Template_HtmlizedExceptionSourceFileName, FormatSourceFile (exc.FileName));
				if (isParseException || isCompileException) {
					int[] errorLines = exc.ErrorLines;
					int numErrors = errorLines != null ? errorLines.Length : 0;
					var lines = new StringBuilder ();
					for (int i = 0; i < numErrors; i++) {
						if (i > 0)
							lines.Append (", ");
						lines.Append (errorLines [i]);
					}
					values.Add (ExceptionPageTemplate.Template_HtmlizedExceptionErrorLinesName, lines.ToString ());
				}
			} else
				values.Add (ExceptionPageTemplate.Template_HtmlizedExceptionSourceFileName, FormatSourceFile (exc.FileName));

			if (isCompileException) {
				CompilationException cex = exc as CompilationException;
				StringCollection output = cex.CompilerOutput;

				if (output != null && output.Count > 0) {
					pageType |= ExceptionPageTemplateType.CompilerOutput;
					var sb = new StringBuilder ();
					bool first = true;
					foreach (string s in output) {
						sb.Append (HtmlEncode (s));
						if (first) {
							sb.Append ("<br/>");
							first = false;
						}
						sb.Append ("<br/>");
					}
					
					values.Add (ExceptionPageTemplate.Template_HtmlizedExceptionCompilerOutputName, sb.ToString ());
				}
			}
		}