The View-switcher feature in ASP.NET MVC 4 makes it easier to make existing desktop-focussed web apps play nice on mobile devices. Scott Hanselman demoes how to use this feature and shares other tips.
Some client-side fixes that can usually be applied to make a website look good on mobile devices -
- Using the viewport metatag
- CSS Media Queries
- Leveraging JQuery mobile features through data-role tags
Useful as they are, these techniques do not optimize for bandwidth or consider the usability differences between desktop and mobile devices. ASP.NET, with it's built-in browser detection support and the new View-switcher feature, now allows to switch view modes and send separate mobile-optimized views instead of desktop views. Since even partial views can be switched, combined with the above client-side techniques, you can replace the bandwidth-heavy or least user-friendly components of your web app and still maximize reuse.
You can also use open source projects such as 51Degrees.mobi for enhanced device detection and to access detailed information such as input types, audio format support and more. For more details on various considerations, go through the several resources listed on the ASP.NET Mobile website.
The presentation was a part of DevCon12, Russia. Apart from mobile, Scott also gave talks on the real-time library SignalR and the concept of One ASP.NET. All the video links are available on his blog.