In my previous blog posts, I have demonstrated a simple web app using ASP.NET MVC 3 and EF Code First. In this post, I will be focus on making this application for mobile devices. A single web site will be used for both mobile browsers and desktop browsers. If users are accessing the web app from mobile browsers, users will be redirect to mobile specific pages and will get normal pages if users are accessing from desktop browsers. In this demo app, the mobile specific pages are maintained in an ASP.NET MVC Area named Mobile and mobile users will be redirect to MVC Area Mobile.
Let’s add a new area named Mobile to the ASP.NET MVC app. For adding Area, right click the ASP.NET MVC project and select Area from Add option. Our mobile specific pages using jQuery Mobile will be maintained in the Mobile Area.
- ASP.NET Web Forms version 4.0
- ASP.NET MVC version 3.0
This How To describes various ways to serve pages optimized for mobile devices from your ASP.NET Web Forms / MVC application, and suggests architectural and design issues to consider when targeting a broad range of devices. This document also explains why the ASP.NET Mobile Controls from ASP.NET 2.0 to 3.5 are now obsolete, and discusses some modern alternatives.
- Architectural options
- Browser and device detection
- How ASP.NET Web Forms applications can present mobile-specific pages
- How ASP.NET MVC applications can present mobile-specific pages
- Additional resources
For downloadable code samples demonstrating this white paper’s techniques for both ASP.NET Web Forms and MVC, see http://aspnetmobilesamples.codeplex.com/.
You can download emulators for popular mobile devices and browsers by following these links
Note that if you want to view your application on a real mobile device (which is the only option for fully testing iPhone or iPad, since there’s no true emulator for Windows) you’ll need to host your application in IIS or IIS Express. You can’t easily use Visual Studio’s built-in web server for this, because it won’t respond to requests from other machines.
Reference : http://www.asp.net/Mobile/device-simulators
This article explains approaches for ASP.NET mobile development to determine if an HTTP request is coming from a mobile phone and then redirecting the request to a page optimized for a mobile browser. This has been created using the version 0.1.10.3 of the 51degrees.mobi foundation API.
Please note these instructions will require changes to assembly names, namespaces and file names to work with the latest version of the 51degrees.mobi foundation API.
Method 1: Using ASP.NET to detect the user agent
Use ASP.NET to detect the user-agent adding server-side browser detection and redirection to your website using the ASP.NET platform is quite easy. This code should be inserted into the Page_Load event of the web form code behind file (e.g. default.aspx.cs). To enable this site-wide, just add it to the Page_Load event of the Master Page file.
string strUserAgent = Request.UserAgent.ToString().ToLower();
if (strUserAgent != null)
if (Request.Browser.IsMobileDevice == true ||
strUserAgent.Contains("windows ce") ||
strUserAgent.Contains("opera mini") ||
WURFL stands for Wireless Universal Resource FiLe. It is formerly a FOSS (which stands for Free and Open Source Software) community effort focused on the problem of presenting content on the wide variety of wireless devices. WURFL is a set of proprietary API’s and an XML configuration file which contains information about device capabilities and features for a variety of mobile devices. Until version 2.2, WURFL was release under an “open source / public domain” licensePrior to Version 2.2 device information was contributed by developers around the world and the WURFL was updated frequently reflecting new wireless devices coming on the market. In June 2011, the founder of the WURFL Project, Luca Passani, and Steve Kamerman, the author of Tera-WURFL, a popular high-performance PHP WURFL API, formed ScientiaMobile, Inc to provide commercial mobile device detection support and services, and is the driving force behind WURFL. As of August 30, 2011, WURFL is licensed under a dual-license model, using the AGPL license for non-commercial use and a proprietary commercial license.
At the end of 1999 the first WAP phone was launched in Europe, followed by many others in the following months. By 2001 it became clear that WAP devices exhibited significant differences in the way they handled WAP content. The implication of this was that mobile developers found it difficult to support the increasing numbers of devices; the cost of application development, cost of testing and the cost of the very devices made WAP development expensive as compared to web development. Eventually, some developers realized that they could leverage the open-source model for their efforts. Luca Passani and Andrea Trasatti joined forces to build a community around a shared repository of device capability information, which they named WURFL. Over the years the project has gained followers and supporters from different geographical regions and with different backgrounds. The first basic API was in Perl. Java and PHP libraries appeared shortly afterward, soon followed by a better.NET Framework, Perl version, Ruby, and, more recently, Python, XSLT and C++.