private static string TryGetHtmlErrorMessage(HttpException e)
{
Debug.Assert(e != null);
try
{
return e.GetHtmlErrorMessage();
}
catch (SecurityException se)
{
// In partial trust environments, HttpException.GetHtmlErrorMessage()
// has been known to throw:
// System.Security.SecurityException: Request for the
// permission of type 'System.Web.AspNetHostingPermission' failed.
//
// See issue #179 for more background:
// http://code.google.com/p/elmah/issues/detail?id=179
Trace.WriteLine(se);
return null;
}
}