0

I have Microsoft Chart Controls set up in a Web Forms project. The chart is rendering as a broken image link. The page I'm attempting to add the chart control is in a location with this path:

http://localhost/application/default.aspx

The broken image link being generated is:

http://localhost/Application/ChartImg.axd?i=chart_14e94045c8ec4bd1b79f8ad4a6e25239_0.png&g=10889d08b1644464955d275d1f800315

If I manually change the broken image link to the following, it renders:

http://localhost/ChartImg.axd?i=chart_14e94045c8ec4bd1b79f8ad4a6e25239_0.png&g=10889d08b1644464955d275d1f800315

Web.config:

<add name="ChartImg" verb="*" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />;

<add key="ChartImg" value="Storage=memory;Timeout=20;"/>

(Also tried <add key="ChartImg" value="storage=file;timeout=20;dir=c:\TempImageFiles\;"/ >)

UPDATE

It's the actual location of the ChartImg.axd handler that is causing the problem. I think the page inheritance and namespaces are messed up in this huge legacy project. I'm trying to add the chart to a page in the /Application directory - I need to be able to change path to the handler. Anyone?

IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
  • 1
    I am not sure if this is going to give you any hint but I could not replicate the problem by adding the control in an empty asp.net 4 web application project. The value of the `src` property of the generated `img` is `/Application/ChartImg.axd?i=chart_ [...]` – dpant Nov 19 '19 at 19:26
  • Thanks dpant, I too was able to narrow it down, see update in question. – IrishChieftain Nov 19 '19 at 21:10

1 Answers1

0

I was able to solve this by creating a new page in the project root with the same master page, and then using an iframe in the problematic page to bring in the charts. I could find no other way to programmatically change the "virtual" location of the ChartImg.axd handler itself.

<iframe src="../Metrics.aspx" height="400" width="400" frameborder="0"></iframe>
IrishChieftain
  • 15,108
  • 7
  • 50
  • 91