2

When I create a controller called "home-solutions", the main class is changed to home_solutionsController. The '-' gets replaced with '_'.

localhost/home-solutions

Also, when I call localhost/home-solutions, it says "The resource cannot be found."

How do I create a controller with '-' in its name and call it?

TigerhawkT3
  • 48,464
  • 6
  • 60
  • 97
BenW
  • 1,393
  • 1
  • 16
  • 26

1 Answers1

3

You can't have the '-' as part of your controller name.

But, if what you really need is to support home-solutions in the URL, you could have a custom route which maps to a certain controller (with another name), for instance:

        routes.MapRoute(
            "HomeSolutionsRoute",
            "home-solutions/{action}/{id}",
            new { controller = "HomeSolutions", action = "Index", id = UrlParameter.Optional }
        );
zed
  • 2,298
  • 4
  • 27
  • 44