I need to set up a generic error page for my site, I have added the following code in web config:
<system.web>
<trust level="Full" />
<customErrors mode="On" defaultRedirect="~/Views/Error/index.cshtml">
<error redirect="~/Views/Error/index.cshtml" statusCode="500" />
</customErrors>
</system.web>
I created the Controller:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace SiteTeste.Controllers
{
public class ErrorController : Controller
{
public ActionResult Index()
{
return View();
}
}
}
I created the View:
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="container-fluid">
<div style="margin-top:100px;margin-bottom:100px;" class="col-md-offset-3 col-md-6">
<h1>Ocorreu um erro durante a requisição.</h1>
Ocorreu um erro interno, por gentileza repita o processo ou @Html.ActionLink("Entre em contato","ContactUs","Home") caso o erro persista.
</div>
</div>
But when an error occurs what appears to me is the message:
Error.
An error occurred while processing your request.