I’ve started (probably later than I should) messing around with ASP.NET MVC 2 for a client project. I’d been writing everything very traditionally as an ASP.NET application and it was getting more and more complicated and harder to improve as it’s not my main job but more of a bolt on to what I actually do day to day which is BI and Data Architecture.
As always, I read through a couple of tutorials then decided to have a go. I’d played with Symfony using PHP a couple of years ago and felt I understood the MVC concept OK in seeing if it was a viable alternative to the messy code I was currently creating. As is so often the case, I didn’t read the part of the tutorial that covered Areas and started developing. After a day I started to think about the application structure and realised it had four quite distinct functions and stumbled upon areas.
Again being far too quick off the mark, I created an area and moved some of my controllers into it and funnily enough, they stopped working displaying a 404 Resource Not Found error.
To cut a long story short, after 2 hours on Google, I discovered thanks to this article that I just hadn’t been careful with my namespaces.
So in the moved Controller class files the namespace was still ApplicationName, it should have been ApplicationName.Areas.AreaName obviously replacing application and area names with your own. Recompile and all is well.