ASP.Net MVC: Areas and controllers

Posted by xamlnotes on Geeks with Blogs See other posts from Geeks with Blogs or by xamlnotes
Published on Thu, 16 Jun 2011 18:47:38 GMT Indexed on 2011/06/20 16:24 UTC
Read the original article Hit count: 377

Filed under:

Areas are a great feature of MVC now. The let you put common code into an Area and then its segregated from other code. That makes it really easy to put those common feature in one spot and not have the interfere with other code.

So today I was working on a new area and starting to test code in it. But the controller method could not be found. Testing the routes and all of the names proved no help either. So I am banging my head against the wall.

Then I took a peak at one of the existing controllers in another Area in the same app. Looked similar, but … There was a Namespaceat the top of that controller with that Area in the Namespace.  I had copied my controller in from somewhere else and therefore it did not have the Namespace there.

 

I put in the right Namespace and cool, it worked right away. So add that to your list when testing.

© Geeks with Blogs or respective owner