This project is read-only.

Possible to use same controller name in Library and Web Project?

Aug 9, 2012 at 3:36 AM


I'm not sure if it's possible, but what I would like to do is have my library have the same controller name as my web project so that the urls render the same.  I basically want to create an administrative library that has a controller named "Admin" with a view named "Profile" and plug that into a current project that has an Admin controller as well.  Ideally, I'd like my urls to all have the "Admin" root like such:

/Admin/Users (web project)
/Admin/Students (web project)
/Admin/Profile (library project)

Is this possible?

Thank you!

Aug 10, 2012 at 6:43 AM

I think you should be able to achieve this using custom routes. e.g. maybe your two controller classes don't have to be named the same, but you can still map the relevant routes to the relevant controllers.

Even if the classes have the same same, you can likely solve it using a technique like this one.

Aug 10, 2012 at 6:56 PM

Thank you David.  I ended up mapping specific routes to the library and letting everything else default to my web application.