ComponentOne Chart for .NET (2.0) Search HelpCentral 

Using the HTTPHandler with a Session-based Transfer Method and a per-Application Image ID

To use HTTPHandler with a Session-based transfer method and a per application image ID to transfer C1WebChart to the client, complete the following steps:

1.   Place a C1WebChart control on a form. A Confirmation dialog box appears.

2.   Click Yes to add the HttpHandler to the web.config file. This configures the application to enable the C1WebChart's built-in HttpHandler.

The following entry is added to the Web.config file:

<configuration>

  <system.web>

    <httpHandlers>

      <add verb="*" path="c1chartimage.aspx"

         type="C1.Web.C1WebChart.ImageHttpHandler,C1.Web.C1WebChart.2"/>

    </httpHandlers>

  </system.web>

<configuration>

3.   Configure the data and appearance elements as desired.

4.   Set C1WebChart's properties to the following:

·      Set the ImageRenderMethod property to HttpHandler.

·      Set the ImageTransferMethod property to Session.

·      Set the ImageIDGeneration property to Application.

·      Set the ImageUri property to an empty string.

Run the program and notice the following:

The image tag created should look similar to:

<img id=_c1wc

   src='c1webchartimage.aspx?SessionID=WebForm1.aspx_C1WebChart1_9F0D3D0E'/>

The SessionID attribute is common for each rendering of the chart. This allows existing images to be reused if no changes occur. Since the session object is distinct for each browser session, data is secure for each client. The SessionID attribute provides access to the following Session variables:

WebForm1…9F0D3D0E_ImageBytes (image)

WebForm1…9F0D3D0E_Hash (hash code and image type)

In this case, the _Hash variable contains the following string:

"c1c_104_f1_c69d1f91.png"

This string is uniquely generated from the contents of the chart properties. Each time C1WebChart renders itself, it checks the value of the current hash with the existing hash in the Session object. If there has been no change, then the chart image need not be recreated. This behavior is built into the internal HTTPHandler in C1WebChart to help reduce server load.

The Session object variables names do not change from one render to the next (only the values change), so it is not necessary to delete the session variables with each rendering.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.