We are trying to create two views for our MVC app. Mobile and Web
These were the two links we followed
- Handling routing for both Desktop & Mobile Controllers in one instance of ASP.NET MVC
- Mixing ASP.NET MVC Display Mode Providers and Routing Rules
Created Account/Login.cshtml page and Account/Login.Mobile.cshtml page (with different layouts). Created a default route
routes.MapRoute(
name: "DefaultMobile",
url: "mobile/{controller}/{action}/{id}",
defaults: new
{
mobile = true,
controller = "Home",
action = "Index",
id = UrlParameter.Optional
}
);
But the problem is that we are using routes.MapMvcAttributeRoutes(); and generating urls like \login. Is there a way to force mobile/login to fetch mobile view. something that force the Routing to display mobile view if the url starts with '/mobile/'?
Or is there another way to do it?
http://siteurl/mobile/- JamieD77