无法重定向到错误页面?

时间:2014-03-18 06:28:38

标签: c# asp.net asp.net-mvc asp.net-mvc-5 elmah

我有以下行动。

// POST: /Venue/Delete/5
[HttpPost, ActionName("Delete")] 
[HandleError(ExceptionType = typeof(SqlException), View = "DbError")]
[ValidateAntiForgeryToken]
public async Task<ActionResult> DeleteConfirmed(int id)
{

我尝试通过删除FK引用行引发错误,并在elmah页面中显示以下页面。但是,它仍然会重定向到标准错误页面。

System.Data.SqlClient.SqlException
The DELETE statement conflicted with the REFERENCE constraint "FK_dbo.......

DbError.cshtml具有以下内容。

@model System.Web.Mvc.HandleErrorInfo

@{
    ViewBag.Title = "Error";
}

<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">@Model.Exception</h2>

我预计会显示SqlException的详细说明。

0 个答案:

没有答案
相关问题