Hello,
If I understand correctly, you wish to hide the path to the file generating the error, but still keep the source and error type.
I tried every error message using:
try
{
}
catch (Exception ex) {
Response.Clear();
Response.Write("<h3> Data:" + ex.Data + "</h3>");
Response.Write("<h3> HelpLink:" + ex.HelpLink + "</h3>");
Response.Write("<h3> InnerException:" + ex.InnerException + "</h3>");
Response.Write("<h3> Message:" + ex.Message + "</h3>");
Response.Write("<h3> Source:" + ex.Source + "</h3>");
Response.Write("<h3> StackTrace:" + ex.StackTrace + "</h3>");
Response.Write("<h3> TargetSite:" + ex.TargetSite + "</h3>");
Response.Write("<h3> ToString():" + ex.ToString() + "</h3>");
Response.Write("<h3> GetBaseException():" + ex.GetBaseException() + "</h3>");
}
After these tests, I think you may go for a combination of error messages, e.g.:
- ex.Source + ex.TargetSite + ex.Message
- ex.Source + ex.Message
A second possiblity is removing the address path. But, I think this is quite complicated, unless you know precisely how the exception looks like.
Another option would be to create your own exception message, or class (and override GetBaseException()), and use that.
Hope this helps!