Area Found without Area Name

Sep 21, 2011 at 10:06 PM

I have two projects working correctly, website and precompiled views (PS). The PS contains the controllers and views using the RazorGenerator, it's in an Area. If I access the view like so:


It works perfect, a beatifule thing. However, if I type in:


I get an error that the view cannot be found. This is because it's searching in the websites directories - that is, it found the controller in PS even though the area name is not in the URL. I've tried area="", string[]{} for namespaces, not sure why it still finds a match from PS.

I'm going to try a few other settings with the routes and see if anythign gives.

Any other ideas?

Sep 21, 2011 at 11:27 PM

But is this really specific to using RazorGenerator? i.e. what happens when you try the same thing without it, where everything is in one project?

Sep 22, 2011 at 1:17 AM

I never realized that!!

So it seems that even in the same project, the area name can be superflous! Who would have thought. Accessing an area named Blog with a controller called Post can be acessed with either /blog/post or /post. The good news is that a duplicate controller name (irrespective of Area name) without namespaces will cause an exception. 

Good Call, Mr. Ebbo!

Sep 22, 2011 at 2:25 AM

There are likely ways to prevent this in the routes, but it would be best to discuss in the MVC forum (or StackOverflow) where you'll find all the experts :)