To use HTTPHandler with a Session-based transfer method and a unique 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 Unique.
· 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=91…93&Delete=T'/>
Because the ImageIDGeneration property is set to Unique, the SessionID attribute is unique for each rendering of the chart. It provides access to the following Session variables:
91…93_ImageBytes (image)
91…93_Hash (hash code and image type)
The Delete=T attribute causes the session variables to be deleted after the data is received by the HTTPHandler. This attribute is always invoked for Unique IDs.
The httpHandler entry in the Web.Config file contains the page alias for the class within C1WebChart that handles the http request. In this case, the alias it set to the default value c1webchartimage.aspx. For more details on this, see IHttpHandler Help in the .NET documentation.
Send comments about this topic to ComponentOne. Copyright © ComponentOne LLC. All rights reserved. |