March 2, 2021
Hot Topics:

Smart Clients: Windows Forms Flexibility with Web Application Ease

  • By Paul Kimmel
  • Send Email »
  • More Articles »


There are real limitations to using Windows Forms controls in a Web application. The first is that the <OBJECT> tag does not support the runat="server" attribute. This means no code-behind, which is a compelling reason to use ASP.NET in the first place. Consequently, you must manufacture dynamic interaction with your embedded UserControl using script. In practice, this means that you can set the date in the control but will find it very difficult to detect when a client has changed the date or determine what that date is.

Another real limitation is that, for a client to run this page, they must have the .NET Framework installed. There is no way to ensure that someone on the World Wide Web will or even can download and install the .NET Framework. This means this solution is limited to intranet applications where you can control the clients and ensure they have the .NET Framework. Collectively, the practical uses for embedded Windows Forms controls are very narrow and require a lot of work.

Introducing Smart Clients as a Better Alternative

When you find yourself desiring the flexibility of Windows Forms and the ease of Web application deployment, what you really want are smart clients. For all intents and purposes, a smart client is a Windows Form application that dynamically updates client assemblies using the Assembly class to download assemblies over HTTP. The result is a Windows Form application (that can talk to your server through Web services, for example), which can be deployed and updated over HTTP just like a Web application.

The ingredients you will likely need for a smart client application are the following:

  • XML Web services to transport data back and forth between clients and the server
  • An HTTP updater that automatically looks for assembly updates on your server and downloads them to clients
  • At least a Windows Forms application kernel that downloads the assemblies initially and requests updates at some prescribed interval

Finally, clients will need to modify their security policies to support running downloaded assemblies, but the results are fantastic. Your customers will get a Windows Form application with all of the expressivity they will have come to expect, along with an ease of deployment like the Web provides.

Smart Clients Are the Right Approach

Some programming techniques are working solutions, but they really represent a bastardization or severe programmatic distortion of good practices. You can create a Windows Control Library to use your favorite Windows Forms control in a Web application, but dynamic use of the Windows Forms control in a Web page will be difficult and require a lot of programmatic acrobatics. It really isn't the right approach.

If you find yourself needing Windows Forms controls, you probably need a Windows application. Build a smart client and download updates using HTTP and Web services to go back and forth between client and server. Internet clients will still have to download and install the .NET Framework soon, however—this will be a moot point. The .NET Framework will be as ubiquitous as any other framework (like Borland's VCL or Sun's Java).

You will need several skills to write smart clients, but they are not as hard as you might think. An excellent example of a smart client is the sample program IssueVision, written by Susan Warren and distributed at events such as TechEd this year. If you couldn't make TechEd or need a copy of IssueVision, contact Susan Warren (formerly of Microsoft) at Vertigo Software (http://www.vertigosoftware.com).

Copyright © 2004 by Paul Kimmel. All Rights Reserved.


Paul Kimmel is the founder and chief architect for Software Conceptions, Inc. and a co-founder and President of the Greater Lansing Area .NET Users Group (glugnet.org). He has written several books on .NET and object-oriented programming and is available to build software for your company. You may contact him at pkimmel@softconcepts.com.

Page 2 of 2

This article was originally published on June 18, 2004

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date