0

I have this in my route config

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "Accessibility/{controller}/{action}/{id}",
            defaults: new { controller = "Cardholders", action = "Index", id = UrlParameter.Optional }
        );
    }

However, when I view my project in browser, it doesn't seem to redirect to the action that I have specified. It remains at http://localhost:54358/ which is probably why I'm getting the http error.

I have no problems viewing the page directly, e.g., browinsg it at http://localhost:54358/Accessibility/Cardholders/Index

What could be the issue here?

Null Reference
  • 11,260
  • 40
  • 107
  • 184
  • Sorry it seems I gave you wrong answer. For the default thing take a look at this http://stackoverflow.com/questions/2006673/asp-net-mvc-default-url-view For the error I can't say it seems there is something wrong with your default view (which is not Accessibility/Cardholders/Index from what I can tell) – alfoks Aug 27 '13 at 10:49

1 Answers1

0

You don't have a route that match localhost

If you try "localhost:54358/Accessibility" it should work

If you want that localhost goes to the cardholders page, your route should be:

routes.MapRoute(
    name: "Default",
    url: "{controller}/{action}/{id}",
    defaults: new { controller = "Cardholders", action = "Index", id = UrlParameter.Optional }
);
Icaro Bombonato
  • 3,742
  • 1
  • 17
  • 12