【发布时间】:2013-07-19 11:49:41
【问题描述】:
我想了解如何在 MVC3 中处理特定于休息服务的异常。任何指针? 基本上,我有一个控制器,并且可能有多个 try catch 块和 throw 异常语句。 看完所有帖子后,我有点困惑。 编辑:
public ActionResult Index()
{
IConsumerRequest conReq = oSession.Request();
conReq = conReq.Get();
conReq = conReq.ForUrl(Session["ServiceEndPoint"].ToString());
try
{
conReq = conReq.SignWithToken();
}
catch (Exception ex)
{
throw ex;
}
return View();
}
在抛出异常时,我需要能够重定向到自定义错误页面。 我也通读了这篇文章: Custom error pages on asp.net MVC3 但是如果我的应用程序没有在 IIS 上运行,我该如何处理不同的错误代码,例如 302 或其他任何错误代码。
【问题讨论】:
-
我们能看看你说的一些控制器代码吗?
标签: asp.net-mvc asp.net-mvc-3 exception-handling