在web层的web.config下进行如下配置:当web层中的页面报错时,会自动跳转到根目录下的error.htm页面,提示用户,非常人性化。 <system.web> <customErrors mode="On" defaultRedirect="~/error.htm"></customErrors></system.web>