1

I need to handle bad url in mvc, forexample if i have a url "example.com" and the user came in and put his own url like "example.com/?zeb%n%n%n" i want to show error for this type of url . The route i have is default route

        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Login", action = "Login", id = UrlParameter.Optional }
        );
Imran Shah
  • 11
  • 2
  • Check out: https://stackoverflow.com/questions/236349/asp-net-mvc-handling-bad-url-parameters – ivpavici Nov 08 '18 at 08:03
  • you can also look at this https://stackoverflow.com/questions/619895/how-can-i-properly-handle-404-in-asp-net-mvc – Janmejay Kumar Nov 08 '18 at 09:03
  • I have already try these and its not working because when I run theapplication the default url is exaple.com and the routeconfig gets called but when i change the url after that it doesn't call the routeconfig class so that's why its not working on this scenario or may be I am doing something wrong here I will really appreciate some help plz – Imran Shah Nov 09 '18 at 10:54

0 Answers0