Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
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 Parker228,978 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?
kevin hudsonCourses Plus Student 11,987 Points
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?