Let's say I have a MVC project where there is root folder MVC2 and. Now, I want another MVC project to that MVC2 folder and serve it.
Below url should serve MVC2 project which is just a folder inside the root project. Root project is also MVC.
- currentSite.com -> current mvc app
- currentSite.com/MVC2/ -> should
run nested mvc app.
I think there should be a webconfig setting which should make it work.
Thank you in advance. Any answer will be dearly appreciated.
Is it possible? and if it is , is it possible to interact with each other.
I would strongly re-consider your architecture if you're having to embed MVC projects within one another. Depending on how closely related the two are, I would think about going in the following directions:
- MVC Areas - If both your projects are heavily linked, share a lot of the same code and resources then I would put them as two separate areas within your application. Default area routing would give you currentSite.com/MVC2 aswell, provided your area was called MVC2. This approach means you'd always deploy both sites together as well (if that's something you need to consider).
- Separate Projects - If there's not a great deal of similarity between the two and you'd prefer to keep them separate, then simply have them both sit in one solution and migrate the common code into a separate class library project that sits within the same solution. You can even compile your views using something like RazorGenerator if you need to share any views between the two projects. This approach also means that you can deploy your sites separately as well should you need to. To achieve the desired URL of currentSite.com/MVC2 in this scenario then you can simply set it up as a virtual directory in IIS.