Use of csXImage in an ASP.NET Web Application

A common use for csXImage is as a client side ActiveX control in a web application. Typical applications allow a user to open an image in their web browser, do some editing of the image, and finally upload the image to be saved on a server. We have several examples of this type of application which can be found by following the links at the bottom of this page.

Many users build web applications using an Integrated Development Environment (IDE) such as Microsoft Visual Studio (VS) or Microsoft Visual Web Developer Express (VWDE). As these development environments focus on building ASP.NET applications with server side processing of data, many users are unfamiliar with the concept of processing on the client and find it confusing that csXImage is not used in a similar way to the standard ASP.NET server controls.

This page aims to explain how csXImage can be used when developing a web application in such an environment.

Why is csXImage Processed on the Client and not on the Server?

Letís consider a typical application where a user can scan an image using a scanner connected to their local machine, view the image in the browser, carry out some editing such as rotating or cropping the image, and finally save the image on the server.

When the web page for this application is first opened, the csXImage control will be downloaded from the server to the local client machine. After scanning an image, this image is held in memory locally and the editing of the image takes place locally. No data needs to be transferred to the server until the editing is complete and the final image is uploaded.

Although it is technically possible to do this processing on the server, it is far less efficient. The image would need to be uploaded immediately after scanning. Then the page would need to be refreshed and the image downloaded back to the browser before it could even be viewed by the user. After each edit, a further refresh would be necessary with the image again transferred to the browser. Unless the connection speed is very fast or the image is very small, this is impractical.

For this reason, client side processing is preferred and no server side code, e.g., ASP.NET, is necessary.

So can a csXImage Web Application be Developed in VS or VWDE?

These IDEs can be used for development even when no server side code is required. Whilst it is not necessary, this approach can be useful if your wider application includes other pages that do use ASP.NET code.

Any of our code examples listed below can be opened and tested in VS or VWDE. The following procedure describes how to do this in Microsoft Visual Web Developer 2005 Express. In Visual Studio or other versions of VWDE the procedure may differ slightly, but the principles are the same.

  1. Create a new folder to contain the test application and copy the example .htm file into that folder.
  2. Copy the files csXImageTrial.ocx and csXImageTrial.lpk to the same folder. If you have installed csXImage in the default location, these files can be found in C:\Program Files\Chestysoft\csXImageTrial.
  3. Open VWDE and from the menu select File/Open Web Site. Navigate to the new folder you have created and click Open.
  4. The Solution Explorer window should now list the three files you have added to this application. Right mouse click on the .htm file and select Set As Start Page.
  5. Click the Start Debugging button on the toolbar and the application will load and run in Internet Explorer.

Note that if preferred, the .htm files can be renamed to have a .aspx extension, but this makes no difference to the fact that all code is run on the client not the server. Likewise, it is meaningless to use a Code-Behind file with these pages as there would be no server executable code to go in the file. All the standard controls such as buttons or checkboxes used in our examples are HTML form controls, not ASP.NET server controls.


This site uses cookies for functionality, traffic analysis and for targeted advertising. Click the Accept button to accept our Cookie Policy. The Cookie Policy page offers configuration for a reduced set of cookies for this site.