Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
How does ComicBooks get picked up in the url?
How does ComicBooks get picked up in the url when the class is called ComicBooksController?
Steven Parker220,634 Points
The routing determines the code to use from the URL.
The first part of the URL after the site name indicates the controller. The routing looks for a controller module with that name and "Controller" added to it.
The next part of the URL indicates the action. The routing will then look for a method inside the controller that has that name.
Got it! I think it was just an spelling error. Thanks for the help!
I am currently using VS 2017 and i am having issues viewing the web page when i compile the same code. Is there something that has changed in the naming conventions of Controllers for VS 2017? I still get the same 404 error when i change the directory to add /ComicBooks/Detail
Why do you need the word "controller" in the class name. I know he mentioned that you need it so .net knows it's a controller but wouldn't the inheritance from the Controller class tell it that?
I just asked this question in the last video but It's not clear to me - So I'm understanding it this way if I make a controller called ILoveApplesController that points to the Base Controller then my URL would be /iloveapples/detail ? and this happens because the program is looking for the controller name with the "Controller " name added to it with no spaces?