Hello friends,
I throw an exception to this onexception method but can't get line number of the exception. I tried below code but it return line number as 0.
Please help
public class CustomErrorHandlerAttribute : HandleErrorAttribute
{
public override void OnException(ExceptionContext filterContext)
{
var controllerName = filterContext.RouteData.Values["controller"];
var actionName = filterContext.RouteData.Values["action"];
var st = new System.Diagnostics.StackTrace(filterContext.Exception, true);
var frame = st.GetFrame(st.FrameCount - 1);
var linenumber = frame.GetFileLineNumber(); // returns only 0 its wrong error line num is 72
}
}