Developing Smart Client Apps Coupled With Web Services
Introduction
Typically applications are written either as forms based desktop applications or as web based applications. In some cases you can also use ActiveX controls hosted in IE. .NET Windows Forms provide an attractive alternative to download and run forms based applications locally. In this article I will explain you what a smart client application is and how it offers an attractive model if coupled with ASP.NET web services.
What are Smart Client Applications?
Smart Client Applications are nothing but Windows Forms applications accessed over Internet using browser. You develop Smart Client applications as normal Windows Forms Applications and then place the executable in an IIS virtual root. Then users can access the EXE by typing its URL in their browser. This is how a Smart Client Application works:
- User navigates to the application EXE by typing URL in the browser
- The EXE gets downloaded on the client machine
- The downloaded EXE gets installed in Global Assembly Cache
- The EXE is loaded from GAC and displayed to the user
Advantages of Smart Client Applications
Following are the advantages of Smart Client Applications:
- Rich user interface
- Application gets downloaded for the first time and gets installed in GAC. Future requests are served from this downloaded version.
- In case original application changes the new version is automatically downloaded
- Dependencies get downloaded as and when required and not all at once
Disadvantages of Smart Client Application
Following are the disadvantages of Smart Client Applications:
- The MSIL EXE gets downloaded at client side. So, takes more time to load the first time
- Configuration files (app.config) can not be used easily as in case of pure desktop application
- Since MSIL EXE gets downloaded at client there is risk of client "de-compiling" your code
- There is no central control on the application once it gets deployed to the users.
Smart Clients and Web Services
From above advantages and disadvantages there are two things that need to be take care:
- Somehow your business logic should be prevented to be downloaded at client end. This will reduce the risk of client "decompiling" your efforts.
- Configuration needs to be taken care by some other means
Above problems can be solved if you use ASP.NET web services along with the Smart Client front end. In such an architecture, the smart client simply acts as a front end to your business logic. The core business logic resides in web services. The smart client consumes the web services. This eliminates the risk of somebody reverse engineering your work. Since web services do the majority of work such as data access; web.config can be easily used for configuration purposes (connection string, file paths etc.). We can also centrally control the business logic since no business rules will ship with the smart client.
Sample Application
The sample application provided with this article contains two VS.NET projects - a web service and a windows forms project.
In order to run the projects follow these steps:
- Unzip the supplied ZIP file in a folder
- Create two virtual directories under IIS
- The one virtual directory should point to the web service project
- The another virtual root should point to the windows forms application
- Now navigate to the EXE from Internet Explorer
- The smart client EXE will be downloaded on the client and executed
Bipin Joshi is an independent software consultant and trainer by profession specializing in Microsoft web development technologies. Having embraced the Yoga way of life he is also a meditation teacher and spiritual guide to his students. He is a prolific author and writes regularly about software development and yoga on his websites. He is programming, meditating, writing, and teaching for over 27 years. To know more about his ASP.NET online courses go
here. More details about his Ajapa Japa and Shambhavi Mudra online course are available
here.