Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

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.

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

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"          
     ImageStorageMode="UseImageLocation" 
     ImageType="Png">    ... 
 </asp:Chart>

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.

share|improve this answer
    
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 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
    
@DeepakSemwal, thanks for the update. –  Furqan Jun 20 '12 at 14:46
    
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
show 8 more comments

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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