Reputation: 129
I have been trying to make a web application and everything seems to be ok when I run it in my laptop but its just not working when I try uploading it into the server. I use a Godaddy windows server on .net 4. I tried tinkering with the web.config file but it doesnt seem to work.
This is how my temp image save location in web.cofig looks life
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
Am I missing something? Please help.
Upvotes: 2
Views: 11310
Reputation: 20693
if you are on shared hosting c:\TempImageFiles\ folder doesn't exists on server, and if somehow you can add that folder, asp.net application doesn't have rights to write outside of its root folder
Store it to the session
<add key="ChartImageHandler" value="storage=session;timeout=20;" />
look at
Upvotes: 4
Reputation: 8784
I was struggling with this same issue on my Godaddy 4GH shared hosting plan and thought I would share my solution.
Insert a chart control into Default.aspx
The following code should pop up in your code behind file
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
Edit your web.config file
I followed instructions on this blog and completely removed the httpHandlers node from my web.config file and overwrote the handlers node with the following code
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler,
System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
Create a directory to store charts
I created a new folder in the application root called Charts
Change chart control settings
Update the ImageStorageMode and ImageLocation properties like this
<asp:Chart ID="Chart1" runat="server" ImageStorageMode="UseImageLocation" ImageLocation="~/Charts/ChartPic_#SEQ(300,3)">
<series>
<asp:Series Name="Series1">
<Points>
<asp:DataPoint AxisLabel="Greg" YValues="1" />
</Points>
</asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</chartareas>
</asp:Chart>
Publish to Godaddy
Edit file permissions on the Charts folder on the published site
Every time you republish your application you will have to repeat step 6.
Upvotes: 2
Reputation: 27927
Guessing that the c:\TempImageFiles\
makes problems on your server
you can also try to set your storage mode to storage=memory
istead of storage=file
check also this good documentation: https://web.archive.org/web/20201205231110/https://www.4guysfromrolla.com/articles/081909-1.aspx
Upvotes: 1