Skip to main content
Email Password   helpLost your password?

Table of Contents

Introduction

What is a Smart Client?

�Smart Clients are easily deployed and managed client applications that provide an adaptive, responsive and rich interactive experience by leveraging local resources and intelligently connecting to distributed data sources�. (MSDN)

Why Smart Client?

Where and When to Implement Smart Clients

The Smart Client architecture is not ideal for every scenario. In situations such as e-commerce, where user platforms are unknown or diverse, the browser-based model continues to represent the most practical approach. However, in the context of a corporate computing environment, where clients are known to be running the Windows operating system, the Smart Client model is the architecture of choice, combining the power and flexibility of rich client applications with the stability and ease of deployment associated with browser-based applications.

Different types of Smart Clients

Smart Clients vary greatly in design and implementation, both in application requirements and in the number of scenarios and environments in which they can be used. Smart Clients therefore can take many different forms and styles. These forms can be divided into three broad categories according to the platform that the Smart Client application is targeting:

In this article we�ll be concentrating only on Windows Smart Client applications.

Purpose of this article

This article demonstrates:

Smart Client Architecture

Platform

As before, Smart Client applications can be delivered by CD, DVD, floppy disk, or via an application deployment infrastructure such as Microsoft Systems Management Server. The .NET Framework introduces yet another option: no-touch deployment, deploying the application from a remote Web server using the Hypertext Transfer Protocol (HTTP).

Smart Clients were introduced in 2002, along with the .NET Framework 1.1 with Visual Studio 2003 release. Building and deploying Smart Client applications takes a giant step forward with Visual Studio 2005 and the .NET Framework 2.0.

In this article, the steps and screenshots given are of Smart Client applications developed using the .NET framework 2 (Beta) with Visual Studio 2005 Beta version.

Solution

Sample Smart Client Application

A simple Windows Application project is developed for demonstration on a Smart Client. In this application, we�ll see:

  1. How to launch an EXE application through a URL.
  2. How to access a URL and parameters.

Here, in the sample demo, we�ll pass the parameter named color_name through URL (web application). Then in the client application, which is nothing but a Windows EXE, we access this value and displays the item (here, the used rectangle) with the color value mentioned.

Below are the steps involved in developing this Smart Client application:

Setting project properties to access the URL

How to access URL and parameters in the Windows application

The following code snippet is used to access the URL in the form:

using System.Deployment.Application;

ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
String str = ad.ActivationUri.ToString();

Split the URL and retreive the value passed in querystring.

Settings for auto detecting and installing prerequisites

The .NET framework is a prerequisite for all the Smart Client applications. This can be auto downloaded when a Smart Client application is called the first time. Following are the various ways to set the auto download feature:

Publish the application

Make Publish directory as virtual directory

After publishing the application successfully, .NET will create a publish directory under the application folder. Make this directory as a virtual directory.

Sample Web Application

These steps will now explain to you how to launch the application from a URL. As it�s mentioned earlier, we are passing a parameter through the URL, which we need, to access in the Windows application. We created some dummy test pages, which we will use to pass the parameter and to launch the application.

Test web page

Below is the JavaScript to detect the presence of the .NET Framework on the client machine. (This is the same method which publish.htm uses to detect the .NET framework.)

<SCRIPT Language="JavaScript">
<!--

//Adding Dotnet Script START ******************

runtimeVersion = "2.0.0";
directLink = "Bomedit.application";

//function window::onload()

function checkComponent()
{
  if (HasRuntimeVersion(runtimeVersion))
  {
      InstallButton.href="http://<DevelopmentMachineName>" + 
        "/<VirtualDirectory>/<ApplicatonName>.application";
  }
  else{
      //If framework is not installed give the link to install the same;

      window.open("http://<DeploymentMachineName>/VirtualDirectory /Test.htm");
  }
}

function HasRuntimeVersion(v)
{
  var va = GetVersion(v);
  var i;
  var a = navigator.userAgent.match(/\.NET CLR [0-9.]+/g);

  if (a != null)
    for (i = 0; i < a.length; ++i)
      if (CompareVersions(va, GetVersion(a[i])) <= 0)
          return true;
  return false;
}

function GetVersion(v)
{
  var a = v.match(/([0-9]+)\.([0-9]+)\.([0-9]+)/i);
  return a.slice(1);
}

function CompareVersions(v1, v2)
{
  for (i = 0; i < v1.length; ++i)
  {
    var n1 = new Number(v1[i]);
    var n2 = new Number(v2[i]);

    if (n1 < n2)
      return -1;
    if (n1 > n2)
      return 1;
  }
  return 0;
}

//Adding Dotnet Script End ******************

-->
</SCRIPT>

Building a Setup Project for Smart Client Applications

Errors Encountered During Development

Below are some of the errors that we faced during development:

Application Identity Not Set

This error comes if you try to access the URL using ApplicationDeployment.CurrentDeployment.ActivationUri by running the project from the IDE. This property can be used only after deploying the application.

File Not Found Exception

<Filename>. Deploy cannot be found.

This is a post deployment error. It occurs if the xyz.deploy file for any of the dependent files is missing in the deployment folder. Check your setup project. Include the xyz.deploy file which is mentioned in the error, and re-deploy the project.

Summary

References

Other Useful Links

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralWorks Great, but a question Pin
Philipose
13:55 23 Feb '06  
GeneralRe: Works Great, but a question Pin
Hemant koppikar
3:09 27 Feb '06  
GeneralRe: Works Great, but a question Pin
Philipose
6:51 27 Feb '06  
GeneralRe: Works Great, but a question Pin
kuodu
10:29 24 Mar '06  
Generalntegrating 2 web applications in .net Pin
Himam
21:30 6 Oct '05  


Last Updated 20 Sep 2005 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009