Considering the omnipresence and importance of mobile phones in our lives, the mobile phone application development is of crucial importance. In this article, we would shortly analyze how to develop mobile applications with an extension to the .NET Framework, called the Microsoft Mobile Internet Toolkit (MMIT) or simply .NET Mobile. The developer should have a prior knowledge of the .NET frame work, HTML and preferably C#.
This is how .NET mobile basically works: A web client requests a web page which travels over the internet. This request is received by the IIS which handles it with the .NET framework. The requested page is then compiled by the ASP.NET. The .NET mobile handles any mobile device requirements. Finally, the required page is returned to the client.
Now a short review of how the actual operation takes place. Mobile Controls are the main building blocks of mobile applications. Mobile Controls are similar to Web Controls in ASP.NET. The following ASP.NET page displays “Mobile Application” as a WML card in a WML enabled cell phone:
1 2 3 4 5 6 7 8 9 10 |
<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" %> <%@ Register TagPrefix="mob" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <mob:Form runat="server"> <mob:Label runat="server">Mobile Application</mob:Label> </mob:Form> |
The Page directive tells ASP to use (inherit) mobile page handling instead of regular page handling. The Register directive defines the prefix that will be used for mobile controls (in this case, mob). The <mob:Form> element tells the server to create a mobile form control. When the ASP .NET page executes, it will produce the following output to a WAP enabled mobile phone:
1 2 3 4 5 6 7 8 9 10 |
<?xml version='1.0'?> <!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN' 'http://www.wapforum.org/DTD/wml_1.1.xml'> <wml> <card> <p>Mobile Application</p> </card> </wml> |
Finally, this output will be produced for a Pocket PC:
1 2 3 4 5 6 7 8 9 10 |
<html> <body> <form id="ctrl1" name="ctrl1" method="post" action="example.aspx"> <div>Mobile Application</div> </form> </body> </html> |
.NET Mobile will generate WML code for WAP enabled cell phones and HTML code for devices like the Pocket PC.
By detecting the browser, .NET Mobile will output correct content, providing developers with a powerful tool to develop single applications that will serve many different mobile devices.