If you're using a default MVC4 project, all you have to do is add another controller called TestController with an action method on it called Index() and www.mywebsite.com/test will route to that controller.
Routing to a controller from the Url address bar
-
22-03-2022 - |
Question
By default all incoming calls go to the home controller. but what I'm trying to do is type in a different controller and go there. MVC4
www.mywebsite.com this will go to the home controller.
www.mywebsite.com/test this needs to go to the test controller but for me its not going, it just says there was a internal server error.
I dont know to look, the routing is simple so I dont think I need to add it to the rout mapping class. I've tried using actionlink as well but I get the same error.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow