2016-09-20 I've recently taken a fancy to learning about ASP.NET Charts. I've built two bar charts -- one basic one and one with some bells and whistles. There's a lot of configuration involved with using the UI.DataVisualization.Charting namespace. I'd never call myself an expert, but I'm happy to share with you what I've learned and where I've learned it. Grab some coffee before we dive into the world of... CONFIGURATION: WEB.CONFIG Happily, if you use the actual drag-and-drop method from the Visual Studio toolbox, the IDE will make the configuration changes for you: 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 element. (1) By the way, I prefer writing the code. I know it takes the "Visual" out of "Visual Studio", but at least in the past the designer would add all kinds of unnecessary code to your project. BUT -- the addition of all of the following Web.Config goop for you is pretty nice. The Web.Config edits occur in multiple places (and these are edits to your root Web.Config, not a Web.Config in your current directory if you have one): (1) Configuration/AppSettings (2) Configuration/System.Web/Compilation/Assemblies (3) Configuration/System.Web/Pages/Controls (4) Configuration/System.Web/Httphandlers These values are straight from my local Web.Config. My solution started as a .NET 3.5 solution and was upgraded to 4.5. Your mileage may vary. CONFIGURATION: THE CHART IMAGE HANDLER (1) Security Environment The configuration of the Chart Image Handler in is especially important. The link in footnote (1) goes into detail about how to configure the handler for the security environment your server operates in. This site, for example, is in a shared hosting environment operating with low or minimal trust. (2) Storage Because my production site runs in low or minimal trust, So my only storage option is session (as opposed to file). If you operate in a higher trust environment, then storage in a file or in memory are also options for you. The example in footnote (1) shows the handler configured for file storage, and includes a directory path. (3) Timeout The default value for the amount of time before the image file can be replaced is 30 seconds. I reduced that timeout value during development. (4) Dir absolute path for image storage if you're using the file storage option. This argument is not necessary if you're using session storage instead. CONFIGURATION: THE CHART CONTROL A number of the Web.config settings can be set directly on the chart control. For example, the storage option indicated in the image handler can also be set as the ImageStorageMode property. Configuring these properties directly on the control will allow for more granular control. I believe properties settings on the control will override the Web.Config settings. That should be it for now! Contact me using the site's contact form if you have questions. Feel free to use the code in your projects. A shout out in your project would be thoughtful. Also, drop me a line and let me know how you might have tweaked things to better suit your needs. Finally, I wouldn't profess to be THE expert on matters represented in my code -- so drop me a line if you have constructive suggestions, too. I'd like to hear from you! Best, halfgk (1) "Image File Management", Microsoft Corporation. Accessed 9/20/2016 from https://msdn.microsoft.com/en-us/library/dd456629.aspx Copyright 2016 halfgk.com