Vikram Vikram - 1 year ago 79
ASP.NET (C#) Question

Front End Versioning the ASP.Net MVC

We've got an enterprise application running on ASP.NET MVC. We've recently started revamping the complete UI of the application. Now, when I say UI, its not simple CSS that I could put in a separate folder and load dynamically. Basically, the complete navigation structure, layout elements, everything is now being revamped. However, the overall code (controllers, models) remains pretty much same with some minor enhancements here and there. Now, we are supposed to roll out the revamped UI but at the same time also support the Old UI in parallel.

The objective is to run the new UI like

rest of the view urls remain the same.

Now, our objective is that we should not have to duplicating the controllers, models into another project.

So, what would be the best approach to serve different views globally across the application based on
identifier for version in the URL?

Answer Source

Using areas you can serve different views using the same controllers. So you create a "v2" area with its own views, and route requests to "v2" accordingly:

    new { area="v2", controller = "Home", action = "Index", id = UrlParameter.Optional })

    new { area="", controller = "Home", action = "Index", id = UrlParameter.Optional });
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download