I am trying the MVC3 exception handling, and came with following test code:
public class HomeController : Controller {
public ActionResult Index() {
throw new ArgumentException();
return View();
}
}
My controller forces to throw exception, and in my web.config
<customErrors mode="On" defaultRedirect="~/ErrorHandler/Index">
<error statusCode="404" redirect="~/ErrorHandler/NotFound"></error>
</customErrors>
I have created another controller to server ErrorHandler/Index and ErrorHandler/NotFound request already.
With my testing, I can see the 404 code could be captured but 500 code has been ignore totally.
Anything wrong with my code?
Thanks Hardy