I tried to redirect to error page on error. but it does not work.
It just giving - Uh-oh, something went wrong! Error Code: 500 message on browser instead of redirecting to error page. error page is already existed in shared folder.
Below is the code in controller:
[HandleError(View = "Error")]
public ActionResult Index()
{
int u = Convert.ToInt32("");// Error line
return View();
}
web config has included below line:
<customErrors mode="On" defaultRedirect="Error"></customErrors>
did google but, it shows above stuff and it should work but still not work.
Using MVC 4 basic template.
Please guide.
thanks
Errors can occur in the error view itself. In that case, the default ASP.NET error page is displayed. To avoid this, you can configure the application to display an error file in the
customErrorssection of theWeb.configfile, as shown in the following example: