To use an ASP Page-based rendering method with a Session-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 Session.
· Set the ImageIDGeneration property to Unique.
· Set the ImageUri to the above ASP Page ( StreamResponse.aspx).
(ImageUri = C:\…StreamResponse.aspx).
Run the program and notice the following:
The image tag created should look similar to:
<img id=_c1wc src='StreamResponse.aspx?SessionID=3b…a5&Delete=T'/>
Because the ImageIdGeneration property is set to Unique, the SessionID is unique for each rendering of the chart.
The Session object variables are:
3b…a5_ImageBytes (image)
3b…a5_Hash (hash code and image type)
The Delete=T attribute means the ASP Page is expected to remove the session variables after the data is received by the page. Delete is always requested for Unique Ids, and is handled by the StreamResponse.aspx code above.
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 Cache, the generated image tag would be identical in format, except that a CacheID would be specified instead of the SessionID, 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. |