[英]How to continue standart Asp.net Mvc - Application Error Page
I handled all error messages if my mvc application running in Release Mode ( Publish mode ) 如果我的MVC应用程序以发布模式(发布模式)运行,则处理了所有错误消息
But when I'm working in debug mode, I can't see standart mvc application error page. 但是,当我在调试模式下工作时,看不到标准的mvc应用程序错误页面。
Because it's redirecting to Error.cshtml which is located in shared folder. 因为它将重定向到位于共享文件夹中的Error.cshtml。
How can I see(or redirect maybe?) standart mvc error page ? 如何查看(或重定向?)标准的MVC错误页面?
protected void Application_Error()
{
// ReSharper disable once RedundantAssignment
// ReSharper disable once ConvertToConstant.Local
bool isCustomErrorEnabled = false;
--#if(!DEBUG) isCustomErrorEnabled = true; -#if(!DEBUG)isCustomErrorEnabled = true; --#endif
- #万一
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (isCustomErrorEnabled) //Context.IsCustomErrorEnabled
{
ShowCustomErrorPage(Server.GetLastError());
}
else
{
//in this line, I want to continue to show standart
// application error page which has error message and stack trace
}
}
UPDATE - Here is my Web.Config file; 更新-这是我的Web.Config文件;
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<globalization uiCulture="auto" culture="auto" />
<customErrors defaultRedirect="/Home/OldLink" mode="On" redirectMode="ResponseRewrite">
<!-- RemoteOnly : Specifies that custom errors are shown only to the remote clients, and that ASP.NET errors are shown to the local host. This is the default value. -->
</customErrors>
MVC 4 Default support to handle error with HandleError attribute is redirecting you to Error.cshtml. MVC 4使用HandleError属性处理错误的默认支持将您重定向到Error.cshtml。
Just update your web.config with customErrors mode="off"
只需使用
customErrors mode="off"
更新您的web.config
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.