我想了解如何处理MVC3中的休息服务特定异常。有什么指针吗? 基本上,我有一个Controller,可能有多个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或其他任何错误代码。