0

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.

NNassar
  • 485
  • 5
  • 11
  • 25
  • 1
    Could you post the full exception stacktrace you are getting? Internal Server error means that there was some problem processing the request on the server which could be caused by an exception being thrown. You should show this exception. – Darin Dimitrov Mar 10 '13 at 17:29
  • Please show your routing and test controller – Dima Mar 10 '13 at 17:29

1 Answers1

0

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.

Eilon
  • 25,582
  • 3
  • 84
  • 102
  • What if I don't have a index view but I do have a editpage.cshtml view and the address in the URL is www.mywebsite.com/test/editpage will this work if there is no index view for that controller? – NNassar Mar 10 '13 at 20:55
  • @user yes it'll work. Just add an EditPage() action method to the controller, and make sure you have an EditPage.cshtml (or .aspx) in the /Views/Test/ folder. Basically, look at everything the HomeController does except that everywhere it says "Home" put "Test". – Eilon Mar 10 '13 at 22:46