Anton Gogolev
Anton Gogolev

Reputation: 115691

ASP.NET MVC controllers with identical names

Here's what I'm trying to do. I have an ASP.NET MVC web application, where I'd like to have a separate "admin" area (accessible via http://example.com/admin) and a regular area, available for all users.

In both these parts of the site I have a /blogs section, but when accessing http://example.com/admin/blogs I want to be presented with admin interface for blogs, whereas usual http://example.com/blogs should just list all blogs.

And the problem itself is: how do I get ASP.NET MVC to instantiate appropriate controllers, provided that there are two BlogsControllers: one in Site.Admin namespace, and the other is in Site.Sitefront namespace?

Granted, I could rename admin controller to BlogsAdminController, but I'd like to keep the names as they already are.

Upvotes: 1

Views: 111

Answers (1)

Kristof Claes
Kristof Claes

Reputation: 10941

Phil Haack has a nice blogpost about this: http://haacked.com/archive/2010/01/12/ambiguous-controller-names.aspx

Upvotes: 2

Related Questions