I'm looking for a way to avoid an error message when the user happens to enter a page that needs a parameter:
namespace Projeto.WEB.Controllers
{
public class ModalidadeController : Controller
{
// GET: Modalidade
public ActionResult Index()
{
return View();
}
[HandleError(ExceptionType = typeof(OverflowException), View = "Home" )]
[HandleError()]
public ActionResult SelecionarModalidade(int id)
{
return View();
}
}
}
The problem, if the user tries to enter directly on this page after it has been saved to your computer. In this case would it have any route to direct the user informing that it was not possible or to direct it to index
?
I tested:
<customErrors mode="On" defaultRedirect="Error" />
Result: