By mswatcher
via odetocode.com
Submitted: Dec 07 2012 / 12:32
You can build custom views for mobile devices in ASP.NET MVC 4 using the DisplayModeProvider features of the framework (see "Browser Specific Views" of the "ASP.NET MVC 4 Mobile Features" article for more details). The default view switching behavior happens by ultimately looking at the incoming user agent header to determine if the request came from a a mobile device, but display modes can do more than just peek at user agent strings. Let's say we don't want a user agent or cookie to tell us which view to use. Instead, we want information in the path of the URL to tell us the view to use. For example, the following URL should always use a "normal" view like Layout.cshtml:
Tweet
SaveShareSend
Tags: .net, frameworks, web design
Add your comment