0

In my web.config, I am using the below code:

<customErrors mode="On" defaultRedirect="Error">
  <error statusCode="404" redirect="~/Error/NotFound/"/>
  <error statusCode="500" redirect="~/Error/InternalServerError/"/>
</customErrors>

But, In my controller actionmethod I am explicitly throwing an error and want to redirect the application to some other default Error page. Below is the code

[HandleError(View = "Error")]
    public ActionResult Index()
    {
        throw new Exception();
        return View();
    }

I want the application should redirect to Error page. But, its always redirecting to NotFound page.

HarshSharma
  • 630
  • 3
  • 9
  • 34

0 Answers0