• 0

ASP.NET Friendly urls breaking crystal report images


Question

So I have an ASP.net application that has FriendlyURLs enabled (and used) and a crystal report viewer.  I am running into an issue with the images on the viewer.

The viewer is on a page called viewreport which when displayed the url shows:

http://site.com/viewreport/

crystal reports uses a file called CrystalImageHandler.aspx for displaying images which ends up creating a url like:

http://site.com/ViewReport/CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_8fbc88c0-1d7b-4b01-9981-9f656a6a7c45.png

Which doesn't work.  Because routing is enabled, it treats the first part as a the page then
 

CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_8fbc88c0-1d7b-4b01-9981-9f656a6a7c45.png

Ends up being an argument causing images to not load.  I have tried to modify the httpHandlers to something like:

<add verb="GET" path="viewreport/CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

But it does not work, I can use javascript to replace all instances of "CrystalImageHandler" in the img src to "/CrystalImageHandler" which shows the images, but since reports can take either a long or short time to load (and the page is considered loaded) outside of having a "Show Images" button I can't rely on the javascript to fire when it should.

Does anyone have any suggestions or ideas on how to get it to redirect from /viewreport/CrystalImageHandler.aspx to /CrystalImageHandler.aspx without requiring user interaction.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I managed to figure out a workaround with jQuery.  It appears that the report loads inside of an iFrame so it's contents load separately and are outside the scope of the base DOM.  

$("[id$=_iframe]").bind("load", function () {
   $(this).contents().find('img').each(function () {
         var curSrc = $(this).attr('src');
         $(this).attr('src', curSrc.replace("Crys", "/Crys"));
   });
});

Doing this works (though I would rather the url to not need to be edited).  So I am still open to suggestions, but for now this works.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.