Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / C#
Article

Building Smart Client using .NET

Rate me:
Please Sign up or sign in to vote.
4.33/5 (51 votes)
13 Jun 20045 min read 377.6K   11.2K   156   46
A Smart Client is an application that uses local processing, consumes XML Web Services and can be deployed and updated from a centralized server

What is a Smart Client?

A Smart Client is an application that uses local processing, consumes XML Web Services and can be deployed and updated from a centralized server. While the .NET Framework (Windows Forms) and the .NET Compact Framework provide the ability to develop Smart Clients with ease, other technologies can provide smart client applications by utilizing the same architecture. Smart Client is the concept of architecting your application solution into a smart, flexible and convenient platform that utilizes web services for communication.

Why do we need a Smart Client?

To understand the need lets see the pros and cons of both the existing architectures the Thin Client (Web) and the Thick Client (Desktop)

The Thin Client

The Thin clients or the Web application provided features like –

  1. Easy to Update – Single location update
  2. Easy to deploy – Single location Update
  3. Easy to manage.

If it had the above features then it also had the following issues –

  1. Network dependency – are usually Network based
  2. Poor user experience – mainly emit HTML
  3. Complex to develop.

The Thick Client

The Thick clients or the Rich client or Desktop Applications or Client/Server application provided features like –

  1. Rich User experience – by means of better user interface
  2. Offline capabilities – Need not be connected on a Network
  3. High Developer Productivity
  4. Responsive & Flexible

The Thick did provide the above feature but on the other hand they also had the following issues –

  1. Tough to Update – Each location needs modifications
  2. Tough to Deploy – Deployment had to be done at multiple location
  3. “DLL Hell”

A Smart Client

The above two architectures provide one feature while they lack the other. But a Smart Client combines the best features found in both the architectures.

Image 1

Smart Client Features

A smart client would have the following characteristics:

  • Local Resource Utilization - A smart client application always has code artifacts on the client that enable local resources to be utilized. What do we mean by local resources? We mean everything from hardware to software resources. A smart client may take advantage of the local CPU, local memory or disk, or any local devices connected to the client, such as a telephone, bar-code/RFID reader, and so on. But it may also take advantage of local software, such as Microsoft Office applications, or any installed line-of-business (LOB) applications that interact with it.
  • Connected - Smart client applications are never standalone and always form part of a larger distributed solution. This could mean that the application interacts with a number of Web services that provide access to data or an LOB application. Very often, the application has access to specific services that help maintain the application and provide deployment and update services.
  • Offline Capable - Because they are running on the local machine, one of the key benefits that smart client applications offer is that they can be made to work even when the user is not connected. For applications running in occasional or intermittent connectivity situations, such as those used by traveling workers or even those running on laptops, tablets, PDA's, and so on, where connectivity cannot be guaranteed at all times, being able to work while disconnected is essential. Even when the client is connected, the smart client application can improve performance and usability by caching data and managing the connection in an intelligent way.
  • Intelligent Install and Update - Smart client applications manage their deployment and update in a much more intelligent way than traditional rich client applications. The .NET framework enables application artifacts to be deployed using a variety of techniques, including simple file copy or download over HTTP. Applications can be updated while running and can be deployed on demand by clicking on a URL. The Microsoft(r) .NET Framework provides a powerful security mechanism that guarantees the integrity of the application and its related assemblies. Assemblies can be given limited permissions in order to restrict their functionality in semi-trusted scenarios.
  • Client Device Flexibility - The .NET Framework together with the .NET Compact Framework provides a common platform upon which smart client applications can be built. Often, there will be multiple versions of the smart client application, each targeting a specific device type and taking advantage of the devices unique features and providing functionality appropriate to its usage.

Let us look at one of the very important features of Smart clients – Intelligent Install and Update.

Intelligent Install and Update (Easy Deployment)

Smart client applications manage their deployment and update in a much more intelligent way than traditional rich client applications.

Components

A Smart client application will have two components

  1. A very thin client application to be installed locally
  2. The actual application hosted on a Web Server build using Strong named assemblies

Process involved

When the user opens a Smart client Application –

  1. The User opens the Application.
  2. The application references a assembly hosted on a Web Server
  3. The .NET Framework checks if the previously downloaded assembly is the latest one.
  4. If not downloads the latest version from the server, loads the assembly locally and launches the application.

Advantages

Any updates to the application, a single change and the changes will be reflected to all the clients when they are launched the next time. This is called a smart client.

Lets see the Client Application Code –

C#
using System;
using System.Reflection;
using System.Windows.Forms;
namespace MySmartClient
{
  class SmartClient
  {
    [STAThread]
    static void Main(string[] args)
    {
      SmartClient objSmartClient = new SmartClient();
      
      //display splash screen
       Splash  splash = new Splash();
      splash.Show();
      Application.DoEvents();

      // Set the URL to load the Assembly from
      string strURL = "http://Server/Smart/Bin/Release/Smart.exe";

      // Set the class to call
      string sClassName = "MySmartClient.SmartForm";

      Assembly assemblyContent = null;

      try
      {
        // Load the assembly
        assemblyContent = Assembly.LoadFrom(strURL);
      }
      catch(Exception e)
      {
      }
      splash.Close();
      // Create a object for the Class
      Type typeContent = assemblyContent.GetType(sClassName);
      // Invoke the method. Here we are invoking the Main method.
      try
      {
        typeContent.InvokeMember ("Main", BindingFlags.Public | 
          BindingFlags.InvokeMethod | BindingFlags.Static, null, null, null);
      }
      catch(Exception e)
      {
      }
    }
  }
}

This is all that would be installed on the client. The actual application will be available on the Server. First time the client application is launched, the .NET Framework will download the required assemblies locally. Henceforth every time the application is launched, the .NET Framework will check for the version of the assemblies, if the server has a latest version, it will downloaded or else the locally available assemblies will used to launch the application. This way, any updates to the application can be handled easily at one location, thereby making the deployment of application easy.

Download the client side application and the Server application from the link above.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionSmart Client definition Pin
Member 1042122111-Sep-14 5:42
Member 1042122111-Sep-14 5:42 
Questionoffline smart client application in c# Windows Application Example Pin
sambhajipwr25-Sep-13 21:12
sambhajipwr25-Sep-13 21:12 
GeneralHello Everyone!!!!! Demo Solution is not working for me!!! Pin
vaibhav.s.jain23-Jun-10 20:23
vaibhav.s.jain23-Jun-10 20:23 
GeneralSmart Client SCSF application takes time to load Pin
Sakshi Smriti23-Jul-09 1:58
Sakshi Smriti23-Jul-09 1:58 
QuestionIs the assembly loaded every time? Pin
Member 23161828-Apr-08 0:26
Member 23161828-Apr-08 0:26 
Question.Net Smart client application Pin
prabhu_sap17-Oct-07 17:44
prabhu_sap17-Oct-07 17:44 
QuestionHow to deploy Smart Client Apps? Pin
Venkatesh Mookkan2-Aug-07 1:30
Venkatesh Mookkan2-Aug-07 1:30 
GeneralSmart Client security settings Pin
tarunbounthiyal15-Jul-07 21:00
tarunbounthiyal15-Jul-07 21:00 
QuestionSmart client Pin
srinivas_gummadilli9-Nov-06 23:03
srinivas_gummadilli9-Nov-06 23:03 
GeneralUsing Web Services Through Smart Client Pin
g_sandipan9-Nov-06 21:57
g_sandipan9-Nov-06 21:57 
GeneralHelp me developing Smart client application Pin
VijayaRam10-Oct-06 21:03
VijayaRam10-Oct-06 21:03 
GeneralRe: Help me developing Smart client application Pin
Pete O'Hanlon9-Nov-06 23:38
mvePete O'Hanlon9-Nov-06 23:38 
GeneralRe: Help me developing Smart client application Pin
Prem Alva24-Jan-07 22:00
Prem Alva24-Jan-07 22:00 
QuestionCreating asp.net controls dynamic Pin
Mady_hamdy21-Jun-06 5:34
Mady_hamdy21-Jun-06 5:34 
Generaldependent assembly Pin
eeraymond10-May-06 20:45
eeraymond10-May-06 20:45 
GeneralRe: dependent assembly Pin
Dave Bacher6-Jun-06 7:40
Dave Bacher6-Jun-06 7:40 
Questionabout demo code given by you... Pin
Its_Amol7-Apr-06 21:32
Its_Amol7-Apr-06 21:32 
GeneralSmart client app that functions similar to Outlook 2003 Pin
darule3-Feb-06 10:52
darule3-Feb-06 10:52 
QuestionAbout the Building Smart Client article Pin
sushmakatneni16-Sep-05 19:14
sushmakatneni16-Sep-05 19:14 
Questionhow database query will be handlled thru smart client Pin
gotoneelesh8-Sep-05 3:17
gotoneelesh8-Sep-05 3:17 
QuestionException when network connection unavailable! Pin
Webdiyer29-Aug-05 16:44
Webdiyer29-Aug-05 16:44 
AnswerRe: Exception when network connection unavailable! Pin
Greg Osborne12-Sep-05 7:34
Greg Osborne12-Sep-05 7:34 
GeneralRe: Exception when network connection unavailable! Pin
SimesA18-Mar-09 4:23
SimesA18-Mar-09 4:23 
GeneralDetail smart client articles Pin
Omar Al Zabir31-Jul-05 8:01
Omar Al Zabir31-Jul-05 8:01 
GeneralExcellent explanation what a Smart Client is about Pin
Anonymous11-Jul-05 12:09
Anonymous11-Jul-05 12:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.