Developing Smart Client Apps Coupled With Web Services
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.
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
is a software consultant, trainer, author, yoga mentor, and spiritual guide having 24+ years of experience in software development, consulting, and training. He conducts instructor-led online training courses
in ASP.NET Core, ASP.NET MVC, and Design Patterns for individuals and small groups. He is a published author and has authored or co-authored books for Apress and Wrox press. Having embraced the Yoga way of life he also teaches Ajapa Yoga
to interested individuals. To know more about him click here
Get article updates : Facebook Twitter LinkedIn