Crystal Reports 图像和 ASP.Net MVC [英] Crystal Reports Images and ASP.Net MVC
问题描述
在使用 CrystalImageHandler.aspx 的图表和图像时,我遇到了 Crystal Reports 的问题.图像无法显示,我怀疑这是由于 MVC 路由问题.
I am having trouble with Crystal Reports when using charts and images which use CrystalImageHandler.aspx. The image cannot display and I suspect this is due to a problem with MVC routing.
path图片路径类似这样:
The path image path is similar to this:
src="/CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_a8301f51-26de-4869-be9f-c3c9ad9cc85e.png"
src="/CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_a8301f51-26de-4869-be9f-c3c9ad9cc85e.png"
与此类似的网址:
localhost:01234/ViewCrystalReports.aspx?id=50
localhost:01234/ViewCrystalReports.aspx?id=50
可能无法找到该图像,因为它正在一个不存在的目录中查找.如何更改 CrystalImageHandler.aspx 所在的路径?我认为如果我从根目录引用问题将得到解决,但我在 Web.Config 中所做的任何更改都无法正常工作.
The image cannot be found prumably because it's looking in a non-existant directory. How can I change the path CrystalImageHandler.aspx is located at? I think if I were to reference from the root the problem would be solved but anything I change in Web.Config fails to work.
我应该提到这是在传统的 aspx 页面上,而不是视图等
I should mention this is on a conventional aspx page, not a view etc
推荐答案
想通了.路由干扰了正在生成的 CrystalImageHandler.aspx 链接.Global.aspx 有以下行告诉路由引擎忽略资源文件:
Figured it out. The routing was interfering with the CrystalImageHandler.aspx link that was being generated. Global.aspx has the following line to tell the routing engine to ignore resource files:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
但这不是传统的资源文件,出于某种原因它是一个 aspx 文件(有人知道为什么吗?)
but this isn't a conventional resource file, it's an aspx file for some reason (anyone know why?)
添加此修复它:
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
这篇关于Crystal Reports 图像和 ASP.Net MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!