Building Mobile Websites with ASP.NET MVC 3 & 4
Upcoming SlideShare
Loading in...5

Building Mobile Websites with ASP.NET MVC 3 & 4



Presentation given at Vic.Net User Group in January 2012...

Presentation given at Vic.Net User Group in January 2012
Mobile devices like tablets and phones are quickly becoming the primary way people access the web. So why do so many websites still provide a horrible mobile experience?

With ASP.NET MVC, it's easier than ever to literally put your site in the palm of everyone's hand. MVC 3 has many features that allow you to target mobile devices with different layouts and even content. The recent developer preview of MVC 4 makes things even easier and shows that Microsoft is really thinking about web-enabled devices.

In this demo-heavy session, I'll look at the particular challenges with writing sites for mobile devices, and I’ll show some different techniques and third-party libraries that make targeting mobile devices easy, both in MVC3 and in the Developer Preview of MVC4.

If you saw my talk at DDD Brisbane, rest assured I’ll be delving much deeper into the best way to target mobile sites and I’ll focus more on what MVC 4 will bring to the table.



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Building Mobile Websites with ASP.NET MVC 3 & 4 Building Mobile Websites with ASP.NET MVC 3 & 4 Presentation Transcript

  • Building MobileWebsites withASP.NET MVC 3 & 4Damian Brady @damovisa | #vicnet Delivering Awesome Web Applications
  • AgendaWhy Target Mobile Devices?Zero to MVP in ASP.NET MVCTargeting Mobile Devices
  • Why Target Mobile Devices?  ?  More than ⅓ of Australians access the Internet on their mobile1  In the US, 87% of smartphone owners use it to access the Internet2  In Egypt, 70% of people access the Internet exclusively on smartphones31. AIMIA - PEW Internet - Phil Haack @ Build -
  • Sound Familiar? “It only works on a desktop browser” is the new “It only works in IE”
  • Why? It doesn’t matter It’s too hard
  • Why it Matters Tablets and mobiles Bad experience = lost customerWhat about Intranet? Remember IE6?
  • Too Hard? No. MVC is perfect for multiple devices Understand what’s happening and you’ll be fine
  • Our MVPBasic survey site5 questions for each surveyLooks nice on mobileYou have 51 minutes
  • Targeting Mobile Sites Viewport Metatags CSS Media Queries User-Agent Sniffing
  • Visual Viewport Layout Viewport
  • Viewport Metatags Least effort Less than perfect results Same content sent
  • CSS Media Queries Supported by most mobile devices Adaptive layouts Needs a good structure Some content can break it Same content sent + more
  • User-Agent Sniffing iPhone 4: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7 HTC Desire: Mozilla/5.0 (Linux; U; Android 2.3.7; en-au; HTC Desire Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 Windows Mobile: Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; <manufacturer>; <model> [;<operator])
  • User-Agent Sniffing Best Results Targeted (less) content Most effort Needs maintenance
  • Zero to EverywhereMobile is importantEF + MVC = MVPTarget Mobile Devices: Viewport metatag Adaptive CSS User-agent sniffing
  • Top TipsIf starting from scratch:1. Think about your structure and CSS2. Never use flash or mouseover events3. Don’t redirect or change the URLIf modifying for mobile:1. Start with general changes and get more specific2. Make use of tools and nuget packages
  • 3 things… @damovisa
  • Thank You!Sydney | Melbourne | Brisbane | Delivering Awesome Web Applications