When the Chart.RenderType property is set to ImageTag, the Chart control is rendered as standard image (img) tag. Displaying an image in current web browsers is a two stage process: first the browser renders the html page and then downloads the image from specified Url. Because real chart image is created during web page processing the Chart needs a storage where image will stay until the browser requests it.
You can specify how the Chart control manages the image files. To do this, use the ImageStorageMode property. By default, the ImageStorageMode property is set to UseHttpHandler. This causes the Chart control to use the ChartHttpHandler that is registered in the web.config file to manage the rendered chart images.
Use the chart HTTP handler to:
When you drag a Chart control from the Toolbox onto the design surface of the ASP.NET page, the ChartHttpHandler is automatically registered in the web.config file as "ChartImageHandler". You can configure ChartImageHandler's behavior in the <appSettings> element. The applicable code section is provided below with the automatically generated settings:
<appSettings>
<appSettings> <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" /></appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
</appSettings>
Use the parameters in the value attribute to configure the chart HTTP handler. See the table below for a description for each parameter.
value
Storage mode. Three options are available:
file: Store the rendered chart images as temporary files. You must also specify the storage location in the url or dir parameter. In a server cluster or a multiple-process site, you must specify the dir parameter.
memory: Store the rendered chart images in the memory space of the running process. Do not use this option in a server cluster or a multiple-process site.
session: Store the rendered chart images in a session variable.
The relative URL of the image storage location. If the dir parameter is specified, it is used instead of url. The default value is "~/".
The timeout period in seconds for rendered chart images. After this period has elapsed for an image, it may be replaced by a newer image. The default value is 30.
MyNamespace.MyClass.MyHandler
Privacy protection. When set to true, the generated image can only be downloaded by its owner if some of the following types of identifications are enforced:
The default value is true.
Whether the image should be deleted after successful download from a client. The default value is true.
Whether to store rendered chart images in memory when running the application in full trust level using the Visual Studio development server.
The default value is true. This may mean that your settings in the web.config file have no effect when you run the ASP.NET application from Visual Studio.
Full trust: All configuration variations apply.
High trust: The ASP.NET Development Server cannot be detected. Therefore, webDevServerUseConfigSettings has no effect.
Medium trust: Same as high trust.
Low trust: Same as high trust, except that file access is forbidden. The storage parameter must be set to session or memory.
Minimal trust: Same as low trust, except that the chart HTTP handler detection fails. This means that the ChartImageHandler key in your web.config file is mandatory.
ChartImageHandler