這是我的代碼。當我將響應重定向到動作時,模型聯編程序不起作用。重定向到帶有參數和模型綁定的操作不起作用
任何人都可以幫助我嗎?
public void OnException(ExceptionContext filterContext)
{
var action = filterContext.RouteData.Values["action"];
var controller = filterContext.RouteData.Values["controller"];
var values = filterContext.RouteData.Values;
var exceptionMessage = filterContext.Exception.Message;
var exception = filterContext.Exception;
filterContext.ExceptionHandled = true;
ExceptionInfo ExceptionInfo = new ExceptionInfo();
ExceptionInfo.ActionName = action.ToString();
ExceptionInfo.ControllerName = controller.ToString();
ExceptionInfo.ExceptionMessage = exceptionMessage;
filterContext.HttpContext.Response.RedirectToRoute(new
{
action = "Error",
controller = "Home",
ExceptionInfo = ExceptionInfo
});
}
public ActionResult Error(ExceptionInfo ExceptionInfo)
{
return View(ExceptionInfo);
}
我試過,但相同的結果 –