How to add an image to an SSRS report with a dynamic url?-Collection of common programming errors
I have this problem too..
I have looked at the SSRS error logs, and the IIS server logs. Some findings:
- External images with URLs to static images work. (e.g. http://intranet/site/logo.jpg)
- I can add parameters to static image URLs and it still works. (e.g. http://intranet/site/logo.jpg?foo=1) The parameter will be ignored, and the image displays. This suggests that SSRS is not choking on the ?.
- If I link the external image to an ASPX page that returns a report with no parameters (e.g. http://intranet/site/image.aspx), it still doesn’t work.
- IIS logs show the report server requesting the image, and getting a 200 OK response.
- Report server logs show this:
webserver!ReportServer_0-116!14cc!01/09/2012-12:20:29:: i INFO: Processed report. Report=’/Path/ReportName’, Stream=” ui!ReportManager_0-115!7b8!01/09/2012-12:20:29:: Unhandled exception: System.Web.HttpException: File does not exist. at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context) at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I wonder if SSRS is doing something boneheaded like adding the “correct” file extension before saving the file?
i.e. something like (1) SSRS downloads /Page.aspx, which supplies an image with Content-Type: image/jpg; (2) SSRS saves this to a temporary folder with a filename like tempname.aspx.jpg; (3) SSRS looks for tempname.aspx to incorporate the image into the report; (4) Error
I suppose you could test this by handling .jpg requests in code-behind… Unfortunately that’s beyond my ASPX skills at the moment.