I noticed that the MapRoute extension includes an overload that accepts a string[] parameter which is called ‘namespaces’. I read what Google had for me on it, and supposedly this is to help the framework find controllers in places it wouldn’t otherwise look.
I did some spiking, and tried putting controllers in weird locations. I put one in the Scripts folder; I even built one in a separate assembly with a separate root namespace.
Without putting anyting in the namespaces param, everything worked fine. If I put just one of the namespaces in the namespaces param, it still found all my controllers. I thought maybe it would use that array to disambiguate between similarly named controllers, but that didn’t happen either. A HomeController in MyProj.Controllers and one in SomeOtherName.Stuff would collide still.
So my question is, is that parameter deprecated? Or is it still used somehow in a way that I have yet to discern?
Ok, so after further testing, I figured out that it is not a filter, exactly, but it kinda is also. I gave you ‘answer’ credit even though you’re partially wrong.
So, it does, after all, act like I thought it should which is to say it disambiguates. Basically, the logical flow is something like this:
So, in short, my thought that the namespaces array would serve to disambiguate was correct. The reason my first test in that regard failed is that it only does a perfect match, and I made the mistake of using just the root n/s from the assembly (in other wordss, MyRoot instead of MyRoot.Controllers).
What this namespaces thing allows, then, is to have a HomeController in two different namespaces and match them differently depending on the url or params.