Tuesday, February 2, 2010

How to get detailed COM Exception error message coming in SP2, MOSS 2007

To get detailed COM Exception error message in SP2, MOSS 2007, you need to implement the following application error handler that writes it to the browser screen (Otherwise, we can only see the detailed error message in the server application log recorded as a warning) :

protected void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError().GetBaseException();
System.Web.HttpContext.Current.Response.Write(
"MESSAGE: " + ex.Message +
"SOURCE: " + ex.Source +
"FORM: " + Request.Form.ToString() +
"QUERYSTRING: " + Request.QueryString.ToString() +
"TARGETSITE: " + ex.TargetSite +
"STACKTRACE: " + ex.StackTrace);
Server.ClearError();
}

No comments:

Post a Comment