I currently have the following in my web.config:
<customErrors mode="On" defaultRedirect="~/Error">
<error statusCode="404" redirect="~/Error/NotFound"/>
</customErrors>
I have an Error Controller with:
public class ErrorController : Controller
{
// GET: Error
public ActionResult Index()
{
return View();
}
public ActionResult NotFound()
{
return View();
}
}
404 seems to work, but for any other error the application keeps going to:
localhost/Error
It drops the application name from the url. I tried adding it into the defaultRedirect = "~/MyApp/Error" also tried to make it "~/Error1" instead of "Error" just to check, but in both cases any error would go to localhost/Error.
Do I need to do something extra?