Troubleshooting Errors in ActiveReports in MVC Applications

In my previous blog I had talked about how to use the ActiveReports HTML5 Viewer in an ASP.NET MVC application. The HTML5 Viewer is a really nice client side control to display reports stored on the server. However, there might be situations where you come across some issues while working with the HTML5 Viewer or the WebViewer control in an MVC application and haven't been able to solve the problem even after spending hours. So, I'm going to save you some time and discuss a few issues/errors and how you can resolve them. :) Consider a situation where you add a report (SectionReport(Code based or rpx) or a Page Report(rdlx)), set up the HTML5 Viewer to display the report and press F5 with much anticipation and bam! There's no report displayed in the Viewer. :( Or consider the same situation and when you run the application, you get a 404 Not Found error. Now you're perplexed as to what went missing with no clues whatsoever. Error404 Well, the reason behind these two issues is that the resources required by the HTML5 Viewer to display the reports, have been blocked by the MVC framework. The resolution for the above issues is explained in the two steps given below :

Step 1

1. Go the Solution Explorer and expand the App_Start folder 2. Double click the RouteConfig.cs file to open it 3. Add the following line of code to that file : routes.IgnoreRoute("{*allActiveReport}", new { allActiveReport = @".*\.ar8(/.*)?" }); The RouteConfig.cs file should resemble the following after adding the above line of code. RouteConfig

Step 2

1. Open the Web.config file (the one in the root folder not the one in the View folder) 2. Locate the following directive under system.webserver > handlers section : 3. Comment it out WebConfig Making these two one-liner changes in your application will allow the required references to be loaded in the browser for the HTML5 Viewer/WebViewer to display the reports correctly. Now Rebuild your application and run it. Voila! Your reports appear perfectly in the Viewer. Hope this article helps you with the issues you were facing while using ActiveReports in an MVC application and had no idea how to resolve them. Cheers!


GrapeCity Developer Tools
comments powered by Disqus