cancel
Showing results for 
Search instead for 
Did you mean: 

CR for VS SP09 - Embedded images not showing in CrystalReportViewer

Former Member
0 Kudos

Good Morning Everyone,

I am using Visual Studio 2013 as my IDE, I have installed the CR for VS SP09 and have been able to create a basic web form that displays a report. The report I am using has images embedded in it that display fine within my SAP Crystal Reports 2013 application when I run the report from within it. The images also show up when I export from the web form's crystalreportviewer and print just fine. The problem I am having is more related to the web form report viewer as runtime on the page.

The web form pulls up the report, the data is there all looks great but the images are not showing.

I added the following line to my web.config....

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

but to be honest I do not think the "CrystalImageHandler.aspx exists anywhere on my machine.... am I missing something?

All help is appreciated, thanks!

-Zack

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Here's a workaround for this bug. I recommend copying it and pasting into Notepad (or whatever) before trying to read it.

This is for an ASP.Net 4.5.1 Web Forms app, using Visual Studio 2013, with the latest nuget packages.

I have no idea if it's applicable to MVC or not.

YMMV. I'm not responsible for anything this code does on or to your system, including but not limited to fires, acts of God, and death.

Other than that, use however you want.

First, a new CrystalImageHandler. Obviously, change the namespace to whatever works for you:

using System;

using System.IO;

using System.Web;

using CrystalDecisions.Web;

namespace WebReporting.Code

{

    /// <summary>

    /// Rewrite of the CrystalImageHandler to work around a CR bug.

    /// </summary>

    public class CrystalImageHandler : IHttpHandler

    {

        public bool IsReusable

        {

            get { return false; }

        }

        public void ProcessRequest(HttpContext Context)

        {

            string fileName = null;

            try

            {

                fileName = string.Format("{0}{1}", ViewerGlobal.GetImageDirectory(), Context.Request.QueryString["dynamicimage"]);

                var i = fileName.LastIndexOf('.');

                var contentType = i >= 0 ? string.Format("image/{0}", fileName.Substring(i + 1)) : "image/gif";

                Context.Response.Clear();

                Context.Response.ContentType = contentType;

                Context.Response.AppendHeader("Expires", DateTime.Today.AddYears(1).ToString("r"));

                Context.Response.WriteFile(fileName);

                Context.Response.Flush();

            }

            catch

            {

                Context.Response.Clear();

                Context.Response.StatusCode = 404;

                Context.Response.Flush();

                Context.Response.End();

            }

            finally

            {

                if (fileName != null)

                {

                    try

                    {

                        File.Delete(fileName);

                    }

                    catch

                    {

                    }

                }

            }

        }

    }

}

Here's the web.config entries you need. Again, change the names to match your project:

1) Comment out your entry which is similar to this (you don't need to replace it with anything, just comment it out):

<httpHandlers>

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

</httpHandlers>

2) Comment out your entry which is simular to this, and add the 2 other entries:

<handlers>

  <!-- <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode,runtimeVersion4.0" />-->

  <!-- I don't know if this works with other preConditions. I don't really understand preConditions to begin with, even after reading about them. -->

  <add name="CrystalImageHandler_GET" verb="GET" path="CrystalImageHandler*" type="WebReporting.Code.CrystalImageHandler, WebReporting, Version=1.0.0.0, Culture=neutral" preCondition="integratedMode" />

</handlers>

This fixed the problem for me. Hope it works for you.

former_member183750
Active Contributor
0 Kudos

Hi Dan

Many thanks for the work-around.

And as an update to all hitting on this thread, the issue has been escalate to R&D and a fix is in the works for SP 10 (mid year). Reference: ADAPT01725431




- Ludek

Former Member
0 Kudos

This work-around looks promising, but I have no idea how to get it to work.  Meaning, there's something about the handlers you've created that doesn't seem "right".

Just to back-track ...

I commented out the original entry in web.config (which makes sense), yet was instructed to replace it with two entries?  With one of those two entries being commented out?

And the two entries are wrapped in a handlers tag, that VS complains doesn't exist.  And when I run it, I get a 500.19 complaining of the handlers tag.

And if I ignore the handlers part.  And just cut-paste the tags that you have listed inside your handlers tag, and put them in httphandlers.  Nothing happens.  I break-point in the code (new CrystalImageHandler code) and no breakpoints are hit.  In fact, VS complains about the name attribute not being allowed.  As I modify web.config in VS.  VS also complains that preCondition is not allowed.

There's something not right about the handlers in some way.  Especially in light of all the errors I get when trying to use them.  Of the one that wasn't commented out, it now looks like this for me:

<add verb="GET" path="CrystalImageHandler*" type="CrystalReportsTester.CrystalImageHandler, CrystalReportsTester, Version=1.0.0.0, Culture=neutral" />

As I mentioned, name and preCondition are not allowed (according to VS), so I removed those.  My namespace for my test project is CrystalReportsTester, so I inserted that where necessary.  And the version in my AssemblyInfo.cs was hard-coded to 1.0.0.0.

Former Member
0 Kudos

The <handlers> section should be under <system.webServer>, like this:

  <system.webServer>

    <handlers>

      <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler*" type="WebReporting.Code.CrystalImageHandler, WebReporting, Version=1.0.0.0, Culture=neutral" preCondition="integratedMode" />

    </handlers>

  </system.webServer>

That's the only "CrystalImageHandler" entry you should have. I included the other comment-out entries to show what I replaced in my web.config, but obviously they're not needed.

Hope that helps.

Dan

Former Member
0 Kudos

Oops, my bad.  Put them in wrong section.  Got breakpoint to hit. Didn't work.  Debugging now as to why.

Fails on Context.Response.WriteFile

Former Member
0 Kudos

What's the error?

Former Member
0 Kudos

Welp, this piece of junk Forum software destroyed my response.  Hold on let me re-write the whole thing again.  (I modified my response at the same time you replied, and I received an unexpected error and it blew away everything I typed out - THANKS CRYSTAL FORUMS!!!!!)

It's a System.IO.FileNotFoundException

I see that filename has this value: C:\Users\[MyUserName]\AppData\Local\Temp\cr_tmp_image___localhost_49171\cr_tmp_image_25bba0e5-3ffe-4e9f-a58b-b1cfc4526af5.png

And when I look in: C:\Users\[MyUserName]\AppData\Local\Temp\cr_tmp_image___localhost_49171\

There isn't any files whatsoever.

Now, obviously I didn't create this directory.  This is Crystal, creating the directory, but not dropping the png in there.

I have an IBlobFieldObject that I placed on my report.  The web page starts up, on load I BinaryRead an image of my computer.  I convert it into binary and place it in the System.Byte[] column of my DataSet.  The IBlobFieldObject is tied to this object.  This is code that I just basically stole from an existing project.  So the BinaryRead/IBlobFieldObject code I know is solid.  I've used it for years.

Former Member
0 Kudos

Interesting. My files end up in a subfolder of c:\Windows\Temp (I'm using Windows 7 64-bit). I wonder why they're different? You could use ProcMon to see where the files are going.

Here's my web.config file, with some password stuff removed. See if you can spot any differences that might be relevant:

<?xml version="1.0" encoding="utf-8"?>

<!--

  For more information on how to configure your ASP.NET application, please visit

  http://go.microsoft.com/fwlink/?LinkId=169433

  -->

<configuration>

  <configSections>

      <sectionGroup name="businessObjects">

        <sectionGroup name="crystalReports">

          <section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler" />

          <section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null" />

        </sectionGroup>

      </sectionGroup>

      <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

  <sectionGroup name="elmah">

      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />

      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />

      <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />

      <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />

    </sectionGroup></configSections>

  <businessObjects>

    <crystalReports>

      <crystalReportViewer>

<!--                <add key="ResourceURI" value="~/crystalreportviewers13" />-->

        <add key="ResourceURI" value="/crystalreportviewers13" />

        <add key="documentView" value="weblayout" />

        <add key="EnableTextClipping" value="true" />

      </crystalReportViewer>

      <rptBuildProvider>

        <add embedRptInResource="true" />

      </rptBuildProvider>

    </crystalReports>

  </businessObjects>

  <appSettings>

    <add key="CrystalImageCleaner-AutoStart" value="true" />

    <add key="CrystalImageCleaner-Sleep" value="60000" />

    <add key="CrystalImageCleaner-Age" value="120000" />

  </appSettings>

  <system.web>

    <compilation debug="true" targetFramework="4.5">

      <assemblies>

        <add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

        <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

        <add assembly="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

        <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

        <add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

        <add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

        <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />

        <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />

      </assemblies>

    </compilation>

    <httpRuntime targetFramework="4.5" maxRequestLength="1048576" />

    <authentication mode="Forms">

      <forms defaultUrl="~/Default.aspx" loginUrl="~/Account/Login.aspx" slidingExpiration="true" timeout="2880"></forms>

    </authentication>

    <pages>

      <namespaces>

        <add namespace="System.Web.Optimization" />

        <add namespace="Microsoft.AspNet.Identity" />

      </namespaces>

     

    <controls>

      <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />

    </controls></pages>

    <membership>

      <providers>

        <!--

        ASP.NET Membership is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template

        -->

        <clear />

      </providers>

    </membership>

    <profile>

      <providers>

        <!--

        ASP.NET Membership Profile is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template

        -->

        <clear />

      </providers>

    </profile>

    <roleManager>

      <!--

          ASP.NET Membership Role is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template

        -->

      <providers>

        <clear />

      </providers>

    </roleManager>

    <!--

            If you are deploying to a cloud environment that has multiple web server instances,

            you should change session state mode from "InProc" to "Custom". In addition,

            change the connection string named "DefaultConnection" to connect to an instance

            of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.

      -->

    <sessionState mode="InProc" customProvider="DefaultSessionProvider" timeout="45">

      <providers>

        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />

      </providers>

    </sessionState>

    <httpHandlers>

      <!-- Temporarily replacing the CR image handler with our own version -->     

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

    </httpHandlers>

    <httpModules>

      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />

      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />

      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />

    </httpModules>

  </system.web>

  <system.webServer>

    <security>

      <requestFiltering>

        <requestLimits maxAllowedContentLength="1073741824" />

      </requestFiltering>

    </security>

    <handlers>

      <!-- Temporarily replacing the CR image handler with our own version -->

      <!-- <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode,runtimeVersion4.0" />-->

      <add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler*" type="WebReporting.Code.CrystalImageHandler, WebReporting, Version=1.0.0.0, Culture=neutral" preCondition="integratedMode" />

     

      <add name="websiteThemeImageHandler" verb="*" path="images/theme/*/theme.png" type="WebReporting.Code.WebsiteThemeImageHandler, WebReporting, Version=1.0.0.0, Culture=neutral" preCondition="managedHandler" />

    </handlers>

    <validation validateIntegratedModeConfiguration="false" />

    <modules>

      <remove name="FormsAuthenticationModule" />

    <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" /><add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" /><add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" /></modules>

  </system.webServer>

  <runtime>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <dependentAssembly>

        <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" />

        <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity name="Microsoft.AspNet.Identity.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />

      </dependentAssembly>

      <dependentAssembly>

        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />

        <bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />

      </dependentAssembly>

    </assemblyBinding>

  </runtime>

  <entityFramework>

    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">

      <parameters>

        <parameter value="v11.0" />

      </parameters>

    </defaultConnectionFactory>

    <providers>

      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />

    </providers>

  </entityFramework>

  <elmah>

    <!--

        See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for

        more information on remote access and securing ELMAH.

    -->

    <security allowRemoteAccess="true" />

  </elmah>

 

 

  <!-- NOTE: This section REALLY IS being used! VS or ReSharper might tell you it isn't,

       because nothing matches the path "elmah.axd", but it actually IS being used,

       and is CRITICAL TO SECURITY, so don't remove it!! -->

  <location path="elmah.axd" inheritInChildApplications="false">

    <system.web>

      <httpHandlers>

        <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />

      </httpHandlers>

      <authorization>

        <allow roles="DebugLogViewer" />

        <deny users="*" /> 

      </authorization>

    </system.web>

    <system.webServer>

      <handlers>

        <add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />

      </handlers>

    </system.webServer>

  </location>

 

</configuration>

Former Member
0 Kudos

What's interesting is that the old Handler, CrystalImageHandler.aspx, is creating the folder too, and placing them in the folder.  I see images generated from an hour ago when I tested my production code in my Visual Studio.  The problem with the old Crystal Handler is that you may get the image, but it doesn't display it.  So black X.

I can tell there is an image because I went to cr_tmp_image___localhost_2875 and saw the images.  2875 was the port I used.

The work-around creates the folder, but doesn't place an image there.  I looked in it's folder (cr_tmp_image___localhost_49171), which is different, because it's using another port.

Former Member
0 Kudos

CrystalImageHandler.aspx is not creating the files. It just delivers them to the client. I found that out when I disassembled the code for the original CR handler.


If you look in my code, you'll see there's a reference to ViewerGlobal.GetImageDirectory(). Apparently this isn't returning the right directory for you. I have no idea why not.

If you can figure out where the files are actually being created, you could change my code to get it from there - using some sort of web.config entry so it will work when you put it into production.


Unfortunately, you've hit the limit of my knowledge, which wasn't much to begin with.


Keep us posted, if you solve anything.


Dan

Former Member
0 Kudos

I was thinking about your problems. Have you tried using ProcMon? http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

It's really verbose, but if you have a little patience with it, it will tell you where the image files are being written, and when they're being cleaned up. It's really useful. It just might give you enough information to figure out what's going on.

Dan

PS: I have also been screwed over by this forum's software, several times. The chances of it happening seem to be proportional to how much work I spent typing my post. Now I copy the text before I save, and if anything goes wrong, I immediately paste the text into Notepad so I don't lose it.

Former Member
0 Kudos

Got pulled away to other things.  And I'm back!  Thanks for thinking about me.

I'll do some debugging and see what I can come up with.  This is so odd.

And the issue with the forum software was that I modified the post you were responding to (I forget now if it also happened when I replied to the post you were responding to).  So when I went to save my changes, you had already responded, and that caused this forum to freak out and destroy everything.  Awful.  Especially because I usually do Ctrl+A, Ctrl+C before any web post.  Oh well.

Former Member
0 Kudos

OK.  Figured out what the issue was.

I had two projects.  1 which was just a simple report we use in Production (made copy of folder and made changes there).  The other is a simple Crystal Reports test project that I use when messing around.  The Production project worked fine (using your work-around), the test project didn't.

Here's why the test project didn't:

That's what a typical project looks like for me.  There will be the main tables (and if there are more than one, they are linked).  And there will be a Logos table.  The Logos table is used for all my binary images I display in Headers, etc.

So when I press OK on the Database Expert, I always get the Warning: "Your current link configuration contains multiple starting points.  Please be advised that this is generally not supported."  Which is no big deal for me, as the Logos table is never my starting point.  The other tables will be.

Anyhoo ... I say this, and I wonder if it's related or not to the way I have multiple starting points, but in my Test Project I was only filling the Logos table to test your work-around.  I wasn't putting any data in DataTable1.  And without data in DataTable1 (I have these fields placed on the crystal report, in the details section - for testing), it won't display any images.  Last night as I was driving home I remembered that this was often the case.  It won't display images without data in my data tables.

So I went into my test project, added one row, and the images displayed.

I also went into my Production project, commented out the code that inserted data in it's "data tables", and .... the images displayed!! Huh????   Whatever.  It works in both.

Thanks for the work-around.  If our new code is ready for production before Crystal releases a fix, I'll definitely use your code.  Otherwise, I'll just grab the update from Crystal.  Regardless, excellent job on the work-around, and I can confirm I got it to work in two different projects.

Thanks again.

Former Member
0 Kudos

LOL Glad I ended up helping. And yes, if there's a fix for this before I go live, I'll use their fix.

Your comment made me think of 2 things:

1) All us developers are the same. There's no such thing as being off work - our minds continue to work on problems no matter where we are, or what time of the day or night it is.

2) I guess none of us is capable of creating the "typical" project. We all have to do something different, because, well, we want it the way we want it, right?

Enjoy.

Dan

Former Member
0 Kudos

Hey Ludek,

I see that a SP 10 was released on June 30th.  Does it include a fix for this issue?

Thanks!

Former Member
0 Kudos

In response to #1 - My best ideas are usually on the drive home or in the shower!

former_member183750
Active Contributor
0 Kudos

Kind of...

See this KBA.

- Ludek

0 Kudos

Regarding the no view if no records, check the Report Options. There is a check box option to Suppress printing if no records. This may simply resolve the issue also, or at least that part of the issue.

Don

Former Member
0 Kudos

Can the author of this KBA elaborate on the fix?

For example.  I have no idea what RouterConfig.cs is.  In fact, when I google RouterConfig.cs, Google immediately returns:

Did you mean: routeconfig.cs

And the top-listed results are a Visual Web GUI forum post where people are trying to understand the fix, and something like this: http://dotnetinside.com/en/type/Akka/RouterConfig/0.5.0.0

So in my situation, I've never heard of RouterConfig.cs, nor am I using it, and I don't even know how to add one to utilize it!  I think there needs to be some more elaboration.  I am an ASP.NET Web Application.

Thanks!

0 Kudos

Hi William,

Actually all of the info is in the KBA...

Create a new WEB SITE by going to New Web Site and select this option:

use the defaults and once the site is generated look in the Solution Explorer and you'll see the folder listed in the KBA:

Edit the RouterConfig.cs file and make the change according to the KBA article.

This is all new to in VS 2013 so upgrading an older WEB app likely is not going to have those folders and the config files. Possibly just adding them may work but you should ask Microsoft how to.

These are being generated by the default Templates they created for VS 2013, we can't modify them so the KBA is how to alter the behaviour.


But we are going to update the KBA and add the example above so it is clearer. Older VS projects will not have that folder or config files.

Don

Former Member
0 Kudos

Ok, so it is RouteConfig.cs and not RouterConfig.cs.

Though, I wonder about this proposed solution from Crystal.  Sure, if I have a brand-new project that I created just now, which has RouteConfig.cs - great!  But what about other projects, like mine (and I'm sure others), that were created without a RouteConfig.cs?  As far as I can see I can't just "Add -> New Item" and choose RouteConfig.cs.  Through relentless googling, I can't seem to find anything about the creation of RouteConfig.cs other than the file just appearing when you create a brand new project.

The proposed solution seems narrow in it's scope, and it leaves out alternative project types.  I think that Crystal should address this.

0 Kudos

Hi William,

None of this is CR's doing. It's MS who created the Templates and we don't have any control or input when they create the New Project Templates. Ask MS how to upgrade older WEB Projects to VS 2013. Post your question on MSDN Forums would be the best place.

Also, this is ONLY a problem when using IISExpress and/or running in DEBUG mode, publishing to the full version of IIS and it's not a problem. Configuring it is but that again is Permissions and IIS setup.

Contact Microsoft for help there also, or search first, lots of config help in Forums...

Don

Former Member
0 Kudos

I still think that Crystal, or SAP, is somewhat responsible.  For example, if I have a website that's working great in IE 11, and then IE 12 comes out and some things break, do I tell my users/customers: "Don't upgrade to IE 12, ever, it's Microsoft's fault", or do I figure out what got broken and fix it so it works in both versions?

And yes, they did find a work-around, but with one caveat:  They only took it as far as figuring out the fix when you happen to create a new project in VS 2013, using the new templates, and the MVC architecture it works within, etc.  That's great!

But what they didn't include was a fix for existing projects that were created under previous versions of VS.  And I have asked how to get this to work over at stackoverflow (I will try MSDN today too).  Unfortunately some idiot down-voted it and I got no answer (c# - How to add RouteConfig.cs to an older (2008), now converted (2013) Visual Studio Project? - Sta...).  If you look what I wrote there I do have an understanding.  But does it matter if I add your suggested fixes to RouteTable.Routes if there is no intention of the underlying architecture to do anything with it?  That's what I think is going on here, because I've basically applied the fix and it doesn't fix.

0 Kudos

Hi William,

Don't get me wrong, I'm not blaming anyone, although it does sound that way, it's a result of the way upgrades work in all software these days. With monthly Windows upgrades and sometimes weekly updates to browsers and other third party software it's impossible to keep up with them all. When rules are changed it takes time to make them work. I'll definitely ask R&D if there is anything we can do for older projects but again it's going to take time. Hopefully we will, if we can, make changes in SP 11 to handle old project migration into VS 2013.

You never answered my IISExpress questions? Are you using IISExpress in a Production system? Or are you simply testing this in DEBUG mode? This may be a IISExpress limitation, doesn't matter who's limitation it is...

So, No you tell them CR for VS has not been tested with IIS 12 so at this time don't upgrade. Microsoft changed the rules, we need time to figure it out....

We have the fix as explained for NEW Projects. As for upgrading well... All I can do is ask R&D if they can do anything for the VS 2013 migration Wizard.

As for VS 2013 and IISExpress it is due to IISExpress does not use what previous versions did, in VS 2010 Cassini used registry entries to control everything and CR had access to them, in VS 2012 IISExpress does not so we had to "adjust" our access points and config settings. Now VS 2013 changed again and added new dependencies on those new Config files....

Once again we have to find a work around....

Thanks again

Don

Answers (2)

Answers (2)

Former Member
0 Kudos

For those of us running migrated projects from .Net 4.0 or lower to 4.5+  I have made an observation. It seems if your page that contains the viewer is in a subdirectory then the image urls are being generated relative to that page and not to the root of the web application. E.g if your page is /gl/accounts.aspx then the image may be /gl/crystalimagehandler.aspx etc

A quick way to fix this is to change your handler mapping to a wildcard ending in crystalimagehandler.aspx or put the following code in Global.asax

        protected void Application_BeginRequest(object sender, EventArgs e)

        {

            var p = Request.Path.ToLower().Trim();

            if (p.EndsWith("/crystalimagehandler.aspx") && p!= "/crystalimagehandler.aspx")

            {

                var fullPath=Request.Url.AbsoluteUri.ToLower();

                var index = fullPath.IndexOf("/crystalimagehandler.aspx");

                Response.Redirect(fullPath.Substring(index));

            }

        }

Hope this helps hours of head banging against walls

Former Member
0 Kudos

Thanks for this answer!

Your code in the global.asax along with the following code in the RouteConfig.cs file fixed it for me: routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");

You've saved me a lot of time fiddling with Fiddler etc.

0 Kudos

Hi Zack,

Curious why you added that line? Did you see a kba or other forum post that suggested to do that?

Use Fiddler to track why the image is not displayed?

Is the embedded image linked to an external file? If you view the report with saved data do you see it?

Are you viewing with IIS or are you using the built in IISExpress?

Thanks

Don

Former Member
0 Kudos

I read in the "SAP Crystal Reports .Net SDK Developer Guide" under Setting Up the Development Environment > Project Setup > Web Site Setup in Visual Studio > "Configuring your Web.Config file"

that an http handler needs to be added in order for dynamic images in the viewer control display. Specifically it states....

"If you do not have the CrystalImageHandler setting in your Web.Config file, the images on your website will not show."

and the sample code within the SDK looks like this.....

"

<system.web>

  <httpHandlers>

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

  </httpHandlers>

  </system.web>"

So I am just following with the SDK is telling me to do.... using this Crystal Reports Viewer control, within an asp.net 4.0 webforms project.

Former Member
0 Kudos

Yup.  I'm having the same issue.  And that httpHandler is definitely necessary.

I went from Visual Studio 2008 to Visual Studio 2013, and the basic Crystal Reports that came with VS2008 to SP9.  In 2008, everything worked fine.  Now, in 2013, they don't work.

My reports typically run off a DataSet in the project.  So I'll have a DataTable for the data (what I present on the report), and a DataTable I call Logos.

My code will look something like:

DataTable LogoTbl = m_DS.Tables["Logos"];

DataRow LogoRow = LogoTbl.NewRow();

string ImagePath = ReportFormat.GeImagePath(m_ImgPath, m_ReportDesignerINI.LogoColor);

LogoRow["TheLogo"] = GetImage(ImagePath);

LogoTbl.Rows.Add(LogoRow);

And GetImage looks like:

private byte[] GetImage(string ImagePath)

{

    if (!File.Exists(ImagePath))

    {

        return null;

    }

    using (BinaryReader br = new BinaryReader(File.Open(ImagePath, FileMode.Open)))

    {

        int length = (int)br.BaseStream.Length;

        byte[] theImage = new byte[length];

        theImage = br.ReadBytes(length);

        return theImage;

    }

}

And in the report, I can navigate to my table (under the Database Fields) section, drag the column name to the report, and it appears as an IBlobFiledObject (the column in the data table is defined as a System.Byte[])

This has worked.  And again, it's definitely necessary to have that line in web.config (of course it was a different version # in my 2008 web.config, and I changed it to 13.0.2000.0 for my 2013 web.config).  But with VS2013 and SP9, same code, same web.config entry - no images.  Just little black x's.

Former Member
0 Kudos

No responses from Crystal?  Darn.  I want to ensure this isn't a bug.

Basically, what I do is similar to this: Display image from database in Crystal Report in ASP.Net using C# and VB.Net | ASP.Net, C#.Net, VB....

It's just not displaying.  I'm not sure how much help Fiddler would do.  I've never even used that.

And I've tested this using Local IIS, and IIS Express (I've been able to get the reports to display with both - just not the images).

Former Member
0 Kudos

See my response from today.  I have a how-to link.  Also I've tested this on IIS Express and Local IIS.  Both display all of the report no problem.  Just not the images.

DellSC
Active Contributor
0 Kudos

I believe "13.0.2000.0" is the SP2 version of the assembly.  So, you might need to change it to "13.0.9000.0" for SP9.  I also believe (if I'm reading the reference correctly... ) that the referenced .aspx file is probably embedded in the Crystal.Web assembly, so you wouldn't necessarily have the .aspx file itself.

-Dell

Former Member
0 Kudos

Thanks for the reply.  Appreciated!

I did try 13.0.9000.0, based on your suggestion, for haha's.  Didn't change anything.   Although, just for my own sanity, I think it is 13.0.2000.0, because I see this:http://i61.tinypic.com/2eat9fr.jpg

That's what I'm going off of.  No?  I just want to make sure I'm doing things right.

As for the .aspx, yes.  That is true.  But it was that way in VS2008 using Crystal Report Basic that came with VS2008.  So I'm thinking that might not be the issue.  But I'm open to anything!

former_member183750
Active Contributor
0 Kudos

Hello William

I was able to duplicate the issue... using framework 4.5. Application using framework 4.0, does not have the issue. Perhaps that may do as a "work-around" for now. We're looking into frm 4.5.

One note that I have made a few times before. These are community forums, not technical support as such. Phone incidents and other tasks do get priority. Thus on these forums you may get an answer, you may not. It may be timely, it may not. It may be from "Crystal" / SAP, it may not. If you want dedicated support, you need to create a phone incident here:

Crystal Single Case Technical Support - SAP Business Objects US Online Store | SAP Online Store

Once we have news re. frm 4.5, we'll update this thread.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

OK, thanks for the heads up.

Also,  I should have mentioned the .NET version.  I am using 4.5.1 (which I'm sure would be similar to 4.5).

Thank you for your response --

0 Kudos

Also note that I tested on Windows 8.1 also and I don't see tham either.

But on my Windows 7 64 bit I do see them so this is likely some third party or windows image handler dependency that is missing on these test machines. We start off with clean images so nothing else on them.

My main test PC has everything installed.

We'll keep testing and finding the dependencies...

Don

former_member183750
Active Contributor
0 Kudos

Yup. I should have mentioned I tried with 4.5.1 also. Like you, no joy. Which Was expected...

- Ludek

former_member183750
Active Contributor
0 Kudos

For updates on this issue, please see:

I will be doing further update son that Discussion as things develop.

- Ludek

0 Kudos

FYI, if you create a CR WEB app it works. Somehow this project type is adding a share for the CR Viewer located in the aspnet_client folder to the project.

C:\inetpub\wwwroot\aspnet_client

Still trying to figure out how to do the same for other types of projects:

What you see in Explorer now is this and notice the share on the folder icon:

looking at the properties you see this:

Note the target is grayed out so it can' t be edited.

This is what we are trying to figure out how to replicate so we can add it to other types of projects.

It simply may be a limitation of VS 2013 or CR for VS or both.

I'll ping DEV and ask them what's up...

Don

Former Member
0 Kudos

That shortcut makes the images appear or gives you the ability to use IISExpress (instead of Local IIS)?  As I have a shortcut now, just as you, so that I can use IISExpress:

But, and this is where it can get difficult for me when reading articles on the web, I don't use Web Projects or ASP.NET Projects, etc.  I use Visual WebGUI which takes C# WinForms looking code and generates all the ASP.NET and HTML/CSS/JQuery etc. for you.

Anyhow, as I mentioned, I used the shortcut to allow me to use IISExpress, but it doesn't seem to help with image display.  If I could find, or if I had, an App_Data folder I'd try moving a shortcut there!

Former Member
0 Kudos

Also, as a follow-up, when I use the IE Developer tools on the report, I click the black X where the Image would be and I see this:

So I do get the .aspx (the other thread was mentioning something about not getting the .aspx).  But then when I apply that to say the localhost I'm currently debugging ... for example:

http://localhost:2876/CrystalImageHandler.aspx?dynamicimage=cr_tmp_image_66ae64a0-0953-485d-928f-e38...

I get "The resource cannot be found" - HTTP 404 - Requested URL: /CrystalImageHandler.aspx

former_member183750
Active Contributor
0 Kudos

There is a distinct difference between a shortcut and and the folder having a short cut as a property. Picture being worth a thousand words:

Here is what the aspnet_client folder created by CR Website project looks like:

here is what a "normal" folder looks like:

Notice - no shortcut Tab...

And here is what an actual shortcut properties loos like:

- Ludek

Former Member
0 Kudos

Hrmm.  Maybe I've gotten less-Window-y over the years ... but how does one create, just through Windows, what you suggest?

Meaning, I have copied the whole aspnet_client folder over at first (14 MB), and then moved on to just a shortcut to aspnet_client (as it's 1KB).  I know space is cheap these days buy why copy over 14MB to every project!

In both instances it did nothing to fix the image, just allow me to use IISExpress.

But, and this is where I mention maybe my lack of Windows skills, my copied folder (the one that matches the 14MB you show) doesn't have a tab for shortcut.  Just General, Security, Previous Versions, and Customize.  So how does one create folders ... WITH ... a shortcut property?

EDIT: Btw, the reason I ask is because I did create the project so I could get that specific type of folder with the shortcut property.  And I now see what you are saying.  But when I move or copy that folder to where my real project is, I lose the shortcut property.  Windows takes it away.

0 Kudos

That is the issue, even copying over the short cut doesn't work. Only way it works is if you create a new Crystal Reports project. We have not found the link or how it adds the folder to the poject. The short cut will not work because we don't see a way to set it to the project references.

Actaully I do have one working but I tried so many things, sharing the asp folder and setting various permissions I can't duplicate it now... so it does work some how, just don't know the steps yet....

I ping the Developers to get more info on this part...

Don

former_member183750
Active Contributor
0 Kudos

I've pinged Program Management hoping they have something easy for us to resolve this. If not, we're at reporting this as a bug and waiting for the next Service Pack (mid year + / -).

- Ludek

former_member183750
Active Contributor
0 Kudos

And another update:

The problem comes from creating an ASP.NET Web forms application  (with master pages etc) and .web site. It does not occur when creating a blank web application or a Crystal Reports Web Solution

The culprit appears to be a references to : Microsoft.OWIN namespaces which is causing some authentication issue with our handler for CrystalImageHandler. (HTTP 301 error is what is being thrown.)

I have also been requested by R&D to create an ADAPT (escalation) for a fix. Don or I will update this discussion once we have the ADAPT number and ETA.

former_member183750
Active Contributor
0 Kudos

Hi William

Just as a by the by. I found out that the folder with that shortcut on it, is called a Symbolic Link. As it happens, it has no impact on the issue of the black squares, but I thought I'd just do an update on that mysterious folder.

- Ludek