+ string GetCustomErrorDefaultMessage ()
+ {
+ StringBuilder builder = new StringBuilder ();
+ WriteFileTop (builder, "Runtime Error");
+#if TARGET_J2EE //on portal we cannot know if we run locally
+ if (!HttpContext.Current.IsServletRequest)
+ builder.Append (
+@"<p><strong>Description:</strong> An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed (for security reasons).</p>
+<p><strong>Details:</strong> To enable the details of this specific error message to be viewable, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".</p>
+<table class=""sampleCode""><tr><td><pre>
+
+<!-- Web.Config Configuration File -->
+
+<configuration>
+ <system.web>
+
+ <customErrors mode="Off"/>
+ </system.web>
+</configuration></pre>
+ </td></tr></table><br/>
+");
+ else
+#endif
+ builder.Append (@"<p><strong>Description:</strong> An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons)." + (
+ " It could, however, be viewed by browsers running on the local server machine.")
+ + @"</p>
+<p><strong>Details:</strong> To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".</p>
+<table class=""sampleCode""><tr><td><pre>
+
+<!-- Web.Config Configuration File -->
+
+<configuration>
+ <system.web>
+
+ <customErrors mode="Off"/>
+ </system.web>
+</configuration></pre>
+ </td></tr></table><br/>
+<p><strong>Notes:</strong> The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.</p>
+<table class=""sampleCode""><tr><td><pre>
+<!-- Web.Config Configuration File -->
+
+<configuration>
+ <system.web>
+ <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
+
+ </system.web>
+</configuration></pre></td></tr></table>");
+ WriteFileBottom (builder, false);
+ return builder.ToString ();
+ }
+
+ string GetDefaultErrorMessage (bool showTrace)
+ {
+ Exception ex, baseEx;
+ ex = baseEx = GetBaseException ();
+ if (ex == null)
+ ex = this;
+
+ StringBuilder builder = new StringBuilder ();
+ WriteFileTop (builder, String.Format ("Error{0}", http_code != 0 ? " " + http_code : String.Empty));
+ builder.Append ("<h2><em>");
+ if (http_code == 404)
+ builder.Append ("The resource cannot be found.");
+ else
+ builder.Append (HtmlEncode (ex.Message));
+ builder.Append ("</em></h2>\r\n<p><strong>Description: </strong>");
+