Microsoft Cloud Authors: Pat Romanski, Andreas Grabner, Nick Basinger, Kevin Benedict, Liz McMillan

Related Topics: Microsoft Cloud, Mobile IoT

Microsoft Cloud: Article

INETA's Topic Choice: A Sneak Peek at Mobile Development with VS 2005 and ASP.NET v2.0

Microsoft raises the bar again

With Visual Studio 2005 and ASP.NET v2.0 just around the corner, we are about to embark on another exciting wave of technology. Mobile development is becoming easier with each release, and ASP.NET v2.0 will not disappoint. To start the next adventure in development for mobile browsers, let's first take a stroll down memory lane and then look at the glory that Redmond is sending our way with Visual Studio 2005 and ASP.NET v2.0.

Back in the Day
We've all heard our parents talk about how tough life was back in their younger days. How many times has your Dad told you he had to walk to school uphill, both ways? That proverbial walk is analogous to what mobile developers have endured, although development for mobile devices didn't really start until the very late '90s. Even my employer, Quilogy, had a Web site for our WAP-empowered employees. Developed with ASP, the site was a subset of its desktop counterpart and allowed traveling employees to access the company intranet. That worked fine - as long as the employees restricted their use to a particular handful of phones that were known to interpret the WML markup in the same way.

Other markup languages and many other devices have appeared since then. Though it was great to own a new device, it also meant that developers had to build versions of their Web site for each markup language they wanted to support. This became a maintenance issue for many sites.

Then, ASP.NET came on the scene, along with the Microsoft Mobile Internet Toolkit (MMIT). This was our first taste of an adaptive rendering architecture with which the developer could create a page that served multiple markup languages and allowed for device customization. Sites were typically designed with a set of pages for the large devices and another for small devices. Consequently, there were two different sets of classes even though the mobile object model (small-page classes) was based on the Web classes (large devices).

Now, after three years of .NET, Microsoft has collected feedback, both positive and negative, on how Web developers want to interact with these technologies. The large-page developers who wanted to add mobile support to their sites asked to be able to use the same class set (or API) so they could leverage their existing knowledge of ASP.NET. Mobile developers who use MMIT and ASP.NET mobile controls wanted to utilize the ASP.NET controls that do not have adaptive rendering capability, work under a single class set for all controls, and also continue to have extensibility options.

Let's take a peek at what's coming.

Visual Studio 2005 and .NET v2.0
While attending several DevDays 2004 events, the closing keynote in the Mid America District caught our attention. It was presented by Steve Loethen, a developer evangelist from Microsoft who would dazzle the crowd for an hour and a half by showing the upcoming features in Visual Studio 2005, ASP.NET, and other .NET tools. When you see several hundred people sit quietly in awe at a demonstration, there has to be something to the technology. The following just scrapes the surface.

VB Enhancements
There are so many presents for the VB developer that I can't do them justice in a few short words. There are those developers who think Edit-And-Continue is a must-have. And there are some who preach about the XML documentation feature. I think the new keyword Using is a nice addition since this makes for some mature object handling (calling Dispose at the end of a block). There are other new keywords, such as Continue, Operator, IsFalse, IsNot, Expands, Global, Narrowing, and Widening. There are also new data types (SByte, UInteger, ULong, and UShort). The "Insert Snippet" capability in VS.NET is one that will certainly grab your attention when you hear about the ability to select from 500 pieces of everyday programming just waiting to be imported into your code. And don't forget to check into My Object, a class that provides shortcuts to objects that will make VB.NET even more RAD.

C# Enhancements
When working with VS.NET and C#, there are several new refactoring features (Extract, Encapsulate, Surround, Expansions, Rename, and Change Method Signature). I could also talk about some of the new debugging features, IntelliSense enhancements, or the new formatting assistance built into VS.NET.

.NET Enhancements
There are so many topics to highlight, but here is a quick scan of features: FTP built-in support, HttpWebListener class for hosting a Web server, SOAP 1.2 enhancements, security enhancements for remoting, generics, ObjectSpaces, and DPAPI support.

VS.NET 2005
Another quick list: the ability to import/export IDE settings to different machines, enhanced task-list management, line-revision marks, smart tags, auto save and restore, improved project file handling, improved debugger, improved data designers, improved window docking, and improved automation features.

ASP.NET Enhancements
For .NET to continue as the fastest-growing Web development platform, the ASP.NET team had to really do their homework - and from all indications, they've hit another home run.

Let's start with the goal of increasing developer productivity. In several presentations, the goal of being able to write today's v1.x application with 70% less code was one of the key drivers in this version. This leads to built-in support for membership, role management, master pages, site navigation, site counters, themes and skinning, enhancements to existing controls to save effort in everyday tasks, new administration/configuration features and management, enhanced deployment functionality, health-monitoring, and enhanced performance - even over v1.1.

Other features to note are the ability to invalidate a cache based on database updates and an option to precompile your ASP.NET application in order to avoid distributing code to a host server (i.e., in order to avoid sharing intellectual property).

Unified Control Architecture
Back in the ASP.NET v1.x days, ASP.NET had an architecture that worked pretty well for mobile devices. If we kept our servers up to date with the latest Device Update, our applications could support a lot of devices (over 230 with DU3). It was an elegant architecture in which controls allow adapters to do the rendering. Let's investigate the textbox control from the Mobile Web Forms tab in VS.NET 2003, for example.

In the ASPX file the resulting <mobile:textbox> tag is a System. Web.UI.MobileControls.Textbox object at runtime. The beauty is that the developer is not required to know any more. However, the control class is also connected to adapter classes for each markup language. The adapter classes for the textbox are HtmlTextBoxAdapter, CHtmlTextBoxAdapter, WmlTextBoxAdapter, and XhtmlTextBoxAdapter. These mappings are stored in the machine.config file and can be overridden at the application level. This model was flexible, extensible, elegant, and simple.

But there were always a few negatives around this model: desktop developers had to learn the mobile controls in order to add mobile pages to their applications; mobile developers wanted to use the existing ASP.NET controls in their device applications but couldn't; and Device Updates stored configuration information in the machine-.config file.

In ASP.NET v2.0, these issues have been addressed with the adoption of a unified control architecture. Making all controls participate in this pluggable adapter class model provides several benefits. First, all developers now operate on the same control model. Second, developers can continue to focus on designing large and small pages without worrying about the markup language. Third, the extensibility options (new controls, new adapters, overriding rendering, declarative page customization for a device, etc.) provided to ASP.NET v1.x mobile developers now apply to all controls on any page. This means that mobile controls (i.e., <mobile:xxxx>) are deprecated; however, v1.x applications are still supported at runtime and they are editable in VS.NET 2005 (although not in the technology preview).

.Browser Files
Another enhancement in this area involves how the device configuration is stored. When a request comes in for an ASP.NET page, the page-processing engine performs a set of steps. In one of those steps the page retrieves its adapter class based on the characteristics of the requesting device. This information was formerly stored in the machine.config file (as stated earlier) but now is stored in a Browsers directory under the system's Config folder.

The Config folder holds a series of .browser files such as Default-.Browser, IE.Browser, and UP.Browser. These files are the device capability definitions for the server (i.e., system-wide). They are text files that have the ability to define a new device, indicate how it could be identified via the HTTP headers, and inherit capabilities from an existing definition. These system-wide files are parsed, compiled into an assembly, and then placed in the GAC. Consequently, if you add files to this directory, be sure to look into the aspnet_regbrowsers utility, which updates the shared assembly. You can also add new .browser files to an application's Browser folder, which will be dynamically added at runtime.

Device Filtering
This leads to an interesting capability called device filtering, which is not a new topic for the MMIT and ASP.NET mobile control developers but is different and improved. By knowing the mobile identifiers, a developer can declaratively override properties of a control. Consider the following snippet from an ASPX file:

<asp:textbox id=TextBox1" runat="server"
Text="Default Value" UP:Text="WML Override" />

This will result in a textbox that has an initial value of "Default Value" for all browser types except for the UP type and its derivatives, which will see "WML Override". Device filters can be applied to control properties, custom attributes, templates, page directive attributes, and control directive attributes. This also can happen programmatically.

Controls for Mobile Devices
There are three controls in ASP.NET v2.0 specific to mobile devices: the Pager control, the PhoneLink control, and the SoftkeyLabel property.

The Pager Control
The Pager control serves to break up content into multiple pages. It can be applied to an entire form or to a specific control such as an <asp:repeater>. By setting the ItemsPerPage property, the developer has control over how the form is split. This control supports the ability to show Next and Previous buttons, show page numbers, and even participate in custom pagination in several ways.

The PhoneLink Control
The PhoneLink control has to be one of the greatest ideas in the history of development for mobile devices. Working with this control is simple - just add a formatted phone number. If the requesting device is capable of dialing, this control's adapter will render a hyperlink that can initiate a phone call. If the device is not capable of dialing, then the rendered result will be the text of the phone number.

The SoftkeyLabel Property
The SoftkeyLabel is a property that is exposed from the Button, LinkButton, ImageButton, and PhoneLink controls. This is another oldie from the ASP.NET v1.x days and is used by devices that have softkey buttons (which are located right below the screen). The SoftkeyLabel text will show right above the button and indicates an action that the user can take on that screen. A typical example would be to display "Dial" when using the PhoneLink control.

Other Controls to Consider for Mobile Devices

For traditional Web developers, having different pages rendered from one page is strange. Mobile developers familiar with ASP.NET v1.x are used to having multiple forms in a single ASPX file. This has some benefits, like the ability to share data from different forms and the ability to push multiple forms to a device (in a specific scenario for WML browsers). Since we are going away from the MobilePage class, ASP.NET provides the MultiView control. This is a container of views that are represented by the View control. Views can be selected by using the MultiView's ActiveViewIndex or calling the SetActiveView method.

As you know, ASP.NET supports a model in which we expect to build a page one time and the adapters appropriately render the form. However, the display of graphic images is an area that is specific to the device type. While Pocket PCs will like a JPEG, most WAP devices will prefer a WBMP image. So ASP.NET v2.0 provides the DynamicImage control, which converts the image to the appropriate type for the requesting device.

Table Control
All of us are familiar with how an HTML table typically works. But the new Table control has the ability to work in a special way for mobile devices. When placed on a form, this control will render a standard HTML table for devices with enough screen real estate. For a small device, the control goes into "summary view" mode and will display the first column of the table as links. When one of these links is selected, the table goes into "details view" mode - that is, the rest of the corresponding row is shown, along with navigation for going to the next row or returning to the summary view.

I have only scratched the surface of ASP.NET and its support for mobile devices. I could have covered how other ASP.NET features (like master pages, membership controls, themes and skins, etc.) will work with mobile devices. But from this overview you can surely see that Visual Studio 2005 and ASP.NET v2.0 have raised the bar for Web development, including the support for mobile devices. Now start planning to make those Web sites work for your mobile clients.


  • Box, J., and Fox, D. (2003). "Mobile Accessibility: Technology and Tools (Part 1)" .NET Developer's Journal. SYS-CON Media. Vol. 1, issue 2.
  • Box, J., and Fox, D. (2003). "Mobile Accessibility: Technology and Tools (Part 2)" .NET Developer's Journal. SYS-CON Media. Vol. 1, issue 3.
  • Preview of Web Development with Visual Studio Whidbey: www.asp.net/whidbey/whitepapers/VSWhidbeyOverview.aspx?tabindex=0&tabid=1
  • Homer, A.; Sussman, A.; and Howard, R. (2003). A First Look at ASP.NET v2.0. Addison-Wesley.
  • Authoring ASP.NET Server Control Adapters - An Introduction: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-authorsrvrcntrladapters.asp
  • More Stories By Jon Box

    Jon Box is an Architect Evangelist in Developer & Platform Evangelism with the Microsoft Corporation. He coauthored Building Solutions with the Microsoft .NET Compact Framework, published by Addison-Wesley, and blogs at http://blogs.msdn.com/jonbox/default.aspx.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

    IoT & Smart Cities Stories
    Codete accelerates their clients growth through technological expertise and experience. Codite team works with organizations to meet the challenges that digitalization presents. Their clients include digital start-ups as well as established enterprises in the IT industry. To stay competitive in a highly innovative IT industry, strong R&D departments and bold spin-off initiatives is a must. Codete Data Science and Software Architects teams help corporate clients to stay up to date with the mod...
    There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
    At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
    Druva is the global leader in Cloud Data Protection and Management, delivering the industry's first data management-as-a-service solution that aggregates data from endpoints, servers and cloud applications and leverages the public cloud to offer a single pane of glass to enable data protection, governance and intelligence-dramatically increasing the availability and visibility of business critical information, while reducing the risk, cost and complexity of managing and protecting it. Druva's...
    BMC has unmatched experience in IT management, supporting 92 of the Forbes Global 100, and earning recognition as an ITSM Gartner Magic Quadrant Leader for five years running. Our solutions offer speed, agility, and efficiency to tackle business challenges in the areas of service management, automation, operations, and the mainframe.
    The Jevons Paradox suggests that when technological advances increase efficiency of a resource, it results in an overall increase in consumption. Writing on the increased use of coal as a result of technological improvements, 19th-century economist William Stanley Jevons found that these improvements led to the development of new ways to utilize coal. In his session at 19th Cloud Expo, Mark Thiele, Chief Strategy Officer for Apcera, compared the Jevons Paradox to modern-day enterprise IT, examin...
    With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
    DSR is a supplier of project management, consultancy services and IT solutions that increase effectiveness of a company's operations in the production sector. The company combines in-depth knowledge of international companies with expert knowledge utilising IT tools that support manufacturing and distribution processes. DSR ensures optimization and integration of internal processes which is necessary for companies to grow rapidly. The rapid growth is possible thanks, to specialized services an...
    At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
    Scala Hosting is trusted by 50 000 customers from 120 countries and hosting 700 000+ websites. The company has local presence in the United States and Europe and runs an internal R&D department which focuses on changing the status quo in the web hosting industry. Imagine every website owner running their online business on a fully managed cloud VPS platform at an affordable price that's very close to the price of shared hosting. The efforts of the R&D department in the last 3 years made that pos...