ComponentOne Chart for .NET (2.0) Search HelpCentral 

Using an ASP Page-based Rendering Method with a Cache-based Transfer Method

To use an ASP Page-based rendering method with a Cache-based transfer method, complete the following steps:

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

2.   Click No. An HttpHandler is not used for the ASP Page-base Render Method.

3.   Configure the data and appearance elements as desired.

4.   Set C1WebChart's properties to the following:

·      Set the ImageRenderMethod property to ASPPage.

·      Set the ImageTransferMethod property to Cache.

·      Set the ImageIdGeneration property to Application.

·      Set the ImageUri to the above ASP Page (StreamResponse.aspx).

·      (ImageUri = C:\…StreamResponse.aspx)

·      Set the WebChart.SlidingExpiration property to 00:00:30.

Run the program and notice the following:

The image tag created should look similar to:

<img id=_c1wc src='StreamResponse.aspx?CacheID=WebForm1.aspx_C1WebChart1_9F0D3D0E'/>

Because the ImageIDGeneration property is set to Unique, the CacheID is unique for each rendering of the chart.

The Cache object variables are:

WebForm…3D0E_ImageBytes (image)

WebForm…3D0E_Hash (hash code and image type)

Because the WebChart.SlidingExpiration property is set to 30 seconds, the lifetime of the cache variables is 30 seconds from the last access.

Using an ASP Page instead of the internal HttpHandler allows full control of the stream to be sent to the client. The code given above provides exactly the same function as used by the internal HttpHandler.

ImageUri specifies the full path to the ASP Page used to handle the image. Note that the file part of the Uri must not be the same as any HttpHandlers added to Web.Config. If the same name is used, ASP.NET will use the HttpHandlers instead of the page.

If the ImageTransferMethod were changed to Session, the generated image tag would be identical in format, except that a SessionID would be specified instead of the CacheID, and the data would be added to the Application Cache instead of the Session object.


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