ASP.Net Chart Control On Shared Hosting Environment, Chartimagehandler / Parser Error Problem Solution
[This Article is for those who can manage to run Chart Control on Local Server but not on Web Server]
Chart Control of ASP.Net 3.5 is very handy way to get statictical data as charts. There are variety of ways to display data with Chart Control. Also it is extramely simple to adapt it to your project. But as I hear from so many ASP.Net user nowadays, there might be some problems when it comes to publish it on your web server, especially on shared hosting servers !
After you install the Chart Control, in order to run ASP.Net chart control on your project, you need to configure your web.config file on your root directory which you have already done (I guess !). If you do that properly, you are able to run it on your local server perfectly. But it is not enough for you to be good to go on your web server.
You need to have Chart Control installed on your web server in order to run it on web !
It is easy to do that if you have your own server but for those who have their website files on a shared hosting service, it is a bit hard. But you do not need to beg your hosting provider to make it be installed on server. Only you need to do is to make proper changes on your web.config file and believe me those changes are much more simple than you think ! Of Course, some references is needed to be added to the Bin Folder on your root directory !
- Follow this directory on windows explorer:
C:\Program Files\Microsoft Chart Controls\Assemblies
- You will see 4 DLL files inside the folder. Two of those files are for Windows Applications and two of them for Web Applications. We need web application dll files so copy the dll files which are named 'System.Web.DataVisualization.Design' and 'System.Web.DataVisualization'
- Paste those dll files into the Bin folder on the root directory of your Web Application.
- Secondly, open the Web.Config file on the root directory of your web application.
- Find the <appSettings> node. You have a key add inside this just like below;
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
Replace this tag with the new one as below;
<add key="ChartImageHandler" value="storage=file;timeout=20;"/>
Save the changes on your Web.Config file and close it. Now copy the two dll inside the bin folder and replace the Web.Config file on your server with your new Web.Config file.
That's it !
Now you should be able to run the Chart Control on your Web Server without begging your hosting provider :) If you have any problem with this, I recommend you to check the following codes if they exist on your Web.Config file or not;
...... ... ... ...