简体   繁体   English

ASP.NET 4.0 图表控件损坏的图像链接

[英]ASP.NET 4.0 Chart Control Broken Image Link

I have Microsoft Chart Controls set up in a Web Forms project.我在 Web Forms 项目中设置了 Microsoft Chart Controls。 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 http://localhost/application/default.aspx

The broken image link being generated is:正在生成的损坏的图像链接是:

http://localhost/Application/ChartImg.axd?i=chart_14e94045c8ec4bd1b79f8ad4a6e25239_0.png&g=10889d08b1644464955d275d1f800315 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 http://localhost/ChartImg.axd?i=chart_14e94045c8ec4bd1b79f8ad4a6e25239_0.png&g=10889d08b1644464955d275d1f800315

Web.config: 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.这是导致问题的 ChartImg.axd 处理程序的实际位置。 I think the page inheritance and namespaces are messed up in this huge legacy project.我认为 inheritance 页面和命名空间在这个庞大的遗留项目中被搞砸了。 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.我正在尝试将图表添加到 /Application 目录中的页面 - 我需要能够更改处理程序的路径。 Anyone?任何人?

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.我能够通过在项目根目录中创建一个具有相同母版页的新页面来解决这个问题,然后在有问题的页面中使用 iframe 来引入图表。 I could find no other way to programmatically change the "virtual" location of the ChartImg.axd handler itself.我找不到其他方法来以编程方式更改 ChartImg.axd 处理程序本身的“虚拟”位置。

<iframe src="../Metrics.aspx" height="400" width="400" frameborder="0"></iframe>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM