【发布时间】:2014-02-14 08:06:32
【问题描述】:
catch(Exception ex)
{
System.Diagnostic.StackTrace st=New System.Diagnostic.StackTrace(ex,true);
System.Diagnostic.StackFrame sf=st.getframe(st.frame-1);
int irow=sf.GetFileLineNumber();
int icol=sf.GetFileColumnNumber();
string smsg="Row: "+irow+ " Col "+icol;
Throw New Exception(smsg, ex);
}
这是我在 main 方法中编写的代码,它是在 mvc3 razor 中将 excel 表的所有值插入数据库的实现。现在,请帮助我如何在查看页面上显示此异常消息?
【问题讨论】:
-
您想了解异常详情还是向用户展示?
-
MVC3 : Exception Handling 的可能重复项
标签: c# asp.net-mvc asp.net-mvc-3 exception razor