2

I have 2 MVC websites (and a common library).

In project 'A' i need a URL from project 'B'. In Project 'B' I can use Url.Action("Method", "Controller") to build up the URL.

How would I be able to reference a route from another project across websites? And what about unit testing?

dampee
  • 3,392
  • 1
  • 21
  • 37
  • Put your controllers in a separate project which you can then reference ? – Florian F. Sep 07 '14 at 19:37
  • I wan't clear enough I think. I don't need to have the route twice. I need to reference from one project to a route in the other project. Sharing the controllers in a separate project might does not expose the right route from the other project. Right? – dampee Sep 08 '14 at 13:06

1 Answers1

0

Put your RouteConfig class where you define your routes in the Common library, then in the Global.asax files of both websites call the RegisterRoutes method on that class.

Matteo Mosca
  • 7,380
  • 4
  • 44
  • 80