This is a mirror of official site: http://jasper-net.blogspot.com/

How to Build Mobile Websites with ASP.NET MVC 2 and Visual Studio 2010

| Sunday, March 28, 2010
Helped by the ubiquitous availability of low-priced mobile broadband plans, the "mobile Internet" is becoming more important than ever. The average cell phone user can easily place a bid on eBay, transfer money to their bank account in the Caymans, and check the score of last night's Springfield Isotopes game. For some businesses, having a mobile presence is unimportant, but for others it may represent an increasing percentage of their gross margin. Fortunately, the features provided by today's cutting-edge .NET Framework development platform make mobile web development easier than ever. This article will discuss the various mobile website options available today and show you how you can leverage Visual Studio (VS) 2010 and ASP.NET MVC's powerful features to get your mobile websites to market as quickly and easily as possible.

Various Approaches to Building Mobile Websites
When it comes down to it, the term "mobile website" can mean many things to many people—and some of those definitions can conflict quite severely! The driving goals behind the experience you want to provide to your customers will also be the same drivers behind the technical implementation choices you make in creating that experience. At a high level, most mobile websites leverage one of the following approaches, listed roughly in order of technical difficulty.

No mobile website at all. Many popular mobile devices are somewhat capable of displaying websites. If your site produces clean, standards-compliant markup with no advanced functionality, you may be able to get away with this option. Unfortunately, if you're reading this article, this approach probably does not apply to you.

Standard website with mobile style sheets. If your site comes close to meeting the description presented in the first approach but falls short in a few areas, you might be able to close those gaps by augmenting your site with mobile style sheets. Mobile style sheets are Cascading Style Sheets (CSS) that you can add to the list of style sheets you send to all clients, yet will apply only to mobile devices. This approach is popular because it's deceptively simple and—like the first approach—seems to allow developers to essentially forget mobile devices, confident that both standard web browsers and mobile devices will be able to consume the content that you publish to the web. Unfortunately, this is not realistic. In addition to the fact that some mobile browsers don't include any CSS support at all, those that do may introduce a multitude of issues while attempting to display your pages.

Create multiple different sites or a subsite. Under this third approach, the webmaster has abandoned attempts to share the same exact content and behavior on a mobile and primary website, deciding instead to host multiple autonomous sites. Although the additional overhead may be significant, the approach provides certain benefits. In fact, gaining the ability to focus your efforts on delivering the best experience for all consumers while avoiding compromises made on behalf of mobile devices is so alluring that this approach is incredibly popular.

Use the same website to deliver the same content and behavior in different ways, based on the device. Traditionally, the most technically difficult and high-overhead approach to mobile development has been based around leveraging the same codebase and content to serve all visitors to your site. Under this approach, your website will detect mobile browsers and adapt the markup that it renders, personalizing the results for each supported browser. As you can imagine, this approach offers the best experience for all users since every page they view has been optimized for their device, while also providing the richest and most maintainable back-end solution for developers and IT administrators alike.

As you can tell, all these approaches have their benefits, usually most evident in their ongoing maintenance costs. Unfortunately, the substantial overhead in using one of the more involved approaches to serve both mobile and desktop browser requests has caused many development teams to compromise and settle on a less-expensive approach, losing out on a great deal of benefit in the process. Luckily, the tools offered in VS 2010 and ASP.NET MVC make developing and maintaining codebases that can serve desktop and mobile website users at the same time easier than ever.

ASP.NET MVC Makes Your Life Easier
The newest web framework out of Redmond is a pleasure to work with, making many of the most common web development tasks seem much easier and more straightforward. At the heart of it, ASP.NET MVC is essentially a set of extensions on top of the ASP.NET framework, yet it provides a much different approach to web development than Web Forms. Instead of leveraging the Web Forms' Page Controller pattern (tying views and back-end functionality closely together), ASP.NET MVC takes a different approach by separating the processing of web requests into three distinct responsibilities: the model, view, and controller.

Read more: DevConnections

Posted via email from jasper22's posterous

0 comments: