Can anyone help me to save the chart control temporary image files on SharePoint 2010 document library/picture library. Actually in my standalone environment the webpart is working fine when using c:\TempImageFiles folder for storing the temp image files. But my client's production environment is having more servers with load balancing and the webpart is not working as expected in place of showing charts webpart shows a "X" sign on the top of image/chart. I used chart.ImageLocation = SPContext.Current.Web.Lists["TempImage"].DefaultViewUrl + "/ChartPic_#SEQ(200,30)"; with allow unsafe update as true, but without success. It is throwing javascript errors as Message: Sys.WebForms.PageRequestManagerServerErrorException: Could not find a part of the path 'C:\inetpub\wwwroot\wss\VirtualDirectories\8080\siteURL\TempImage\Forms\AllItems.aspx\ChartPic_000001.png'. Any help in this regard will be appreciable.


When using Load balanced environment the request might not go to the same server where actually the chart image is created. One way to resolve this is setting "IP Affinity" on your load balancer, that shall direct the ongoing requests from a client to the same server where it furnished preceeding requests. Another way is use a UNC path shared across all servers, but that may hinder due to security restrictions in production environment.

Update : @DeepakSemwal , I did not do it myself, but can give a possible way of doing it, looking at the links you referred. Web.config setting.

  <add key="ChartImageHandler" value="storage=file;dir=[you doclib url];"/> 

you might need to give necessary permission on this lib(probably to the 'Network service' or ASPNET_user).

Set chart properties like that (or may be programmatically set it)

 <asp:Chart ID="chart" runat="server" Width="500" Height="350"          
     ImageType="Png">    ... 

while setting the image location in code like

string newUrl = SPContext.Current.Web.Url +"/"+ [doclib].RootFolder.Url; // where doclib is your imageslibrary 
chart.ImageLocation =  newUrl ;

See if it can work for you.

  • Hi Furqan, thanks for your quick rpl.. is it possible to store the chart control's temporary images in SharePoint document library/ Picture Library ? If yes then Hows ? – Deepak Semwal Jun 18 '12 at 7:59
  • @Deepak IMHO, it might not be possible. – Furqan Hameedi Jun 18 '12 at 8:24
  • Hi Furqan, Please have a look link, Roman putting his inputs to save the image in document library. – Deepak Semwal Jun 20 '12 at 13:59
  • Hi Furqan, Manish Joshi also describing to save the temp images in document library link, but when I am trying the same getting javascript errors. Can you help? – Deepak Semwal Jun 20 '12 at 14:51
  • @DeepakSemwal , I updated a answer based on the links you pointed. Though I am not sure 100% for this to work, lets just give it a try. – Furqan Hameedi Jun 21 '12 at 7:47

I think I got a answer for my query, to store the chart images in SharePoint document library we need to map a document library to a hard disc drive (as I did z:) and then set the chart image handler as: <add key="ChartImageHandler" value="storage=file; timeout=3600; url=Z:\;"/> for this to work porperly we also need to change the script manager's async postback timeout property to 3600 as AsyncPostBackTimeOut="3600". The process is taking around 3 minutes (as it first creating the chart images in document library and then downloading those) in my environment which is bit high for the users to wait that much long :( so again searching for some methods that can make the process faster. Hope this can help someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.