I am working on a large production SAAS Webforms application that is going to be slowly migrated to MVC 5. We want to be able to let some customers 'opt-in' to the new MVC pages as they are deployed based on a configurable setting.
The MVC application will be in the same project as the webforms application. The conversion to MVC will go feature by feature to basically create a complete MVC application standing side by side with the webforms application. Once all features are implemented and customers have converted we will remove the webforms project and keep only the MVC project.
If a customer 'opts-in' then we want them to view any MVC views that exist instead of the original aspx page. If an aspx page hasn't yet been converted to MVC OR they customer has not opted-in, then we want them to view the aspx page.
My main concern is preventing the user from manually entering in a url and going to an aspx page when they should be viewing a MVC page or vice versa. Since this application is a multi-tenant system, it cannot be just set in the route configuration because those are only loaded once when the whole application starts. Whatever solution needs to dynamically check the opt-in setting for each user.
Where would be the best place to honor the 'opt-in' setting to force the user to the new MVC route instead of the legacy aspx page if both exist and what is the best way to implement this logic?
A couple of co-workers mentioned that it might could be done using a HTTPModule that checks a collection of aspx page to MVC route mappings.
Basically: If optInToMvcSetting == true && url.contains(".aspx") Then redirect to corresponding route found in aspxToRouteMap.
If optInToMvcSettings == false && !url.contains(".aspx") Then redirect to corresponding aspx page found in aspxToRouteMap.
Does anyone have any thoughts or advice?