1

I'm trying to handle invalid URL parameters.

Basically, if the user enters the address as "mydomain.com/nonexistentpath" or anything else after "mydomain.com/" that is invalid (currently I check for one parameter) I want it to be ignored and url set to default "mydomain.com"

Any ideas how to do that and where to put validator? I'm working on ASP.NET MVC5 website.

adiga
  • 34,372
  • 9
  • 61
  • 83
Grentley
  • 315
  • 3
  • 6
  • 19

1 Answers1

2

Add this in your web.config. You can either redirect to an Error page or your home page. <customErrors mode="On" defaultRedirect="~/Home/Index" />

And also check this answer: How can I properly handle 404 in ASP.NET MVC?

Community
  • 1
  • 1
adiga
  • 34,372
  • 9
  • 61
  • 83