INTRODUCTION


The WebViewer control has been associated with ActiveReports for a long time. With the passage of time, there have been many enhancements made to it terms of both features and performance. Currently in ActiveReports 8, the WebViewer offers four different types of viewers to choose from: RawHtml, Html, Acrobat Reader and the FlashViewer.

COMMON ERRORS


A very common problem which developers report is that the WebViewer works fine on the development machine but upon deploying the application, the WebViewer control either does not render or they get some error messages which are not very informative. Below are some common error messages:

  • "OpenedReport is undefined"
    UndefinedError
    This is a common error when the "FlashViewer" is used as the viewer type in the WebViewer.

  • "ViewerViewModel is undefined"
    This error is similar to the first error except for that it occurs when "Acrobat Reader" is set as the viewer type in the WebViewer.

  • "IOError while loading document. Reason: Error #2032"
    FlashViewerError
    All these errors have a common cause and it is the incorrect handler mappings. But before looking at the resolution, it is important to understand about the HttpHandlers and their role. So let's check it out.


UNDERSTANDING HTTP_HANDLERS


You might have noticed that whenever we add a WebViewer control to the ASPX page, the "GrapeCity.ActiveReports.Web.v8.dll" gets added to the project. This is because its dependency contains the JavaScript libraries which are required during the rendering of the WebViewer control. If the page cannot find or load any of these libraries, the aforementioned errors may occur. Also in case of "HtmlViewer" type, the toolbar will not render correctly, even if an error does not occur. This is where HttpHandlers come to the rescue.

If we check the MSDN link regarding HttpHandlers, we will see that "An ASP.NET HTTP handler is the process (frequently referred to as the "endpoint") that runs in response to a request made to an ASP.NET Web application." Here is how the calls are made to the webserver for ActiveReports javascript libraries. This is a screenshot from the FireBug's Net tab:

ScriptCallsAs you can see in the image, all the requests for scripts ends with an extension ".ar8" which is not a standard web extension. The role of HttpHandlers is to recognize these extensions and redirect it to the correct dll so that required response can be returned from the webserver. However, the request must first make it to the asp.net engine in order for the web.config file to be able to handle the request. This means that IIS must either pass all extensions through to the asp.net engine, or have the .ar8 extension added to it's list.

So we need to add the HttpHandlers either directly to the IIS or to through the web.config file. We will check the latter approach in the next section.

CONFIGURING HANDLER MAPPINGS


In IIS7 and later, users can select from two different Application Pools viz Classic Mode and Default App Pool (Integrated Pipeline Mode). When selecting a particular application pool, the handlers also need to be configured accordingly. Let's take a look at them one by one.
Classic Mode

The HttpHandlers are to be added inside the httpHandlers tag which is under <system.web> and handlers tag which is under <system.webServer>. Below is the corresponding snippet from the web.config file.

&lt;system.web&gt;
&lt;httpHandlers&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.asmx&quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; validate=&quot;false&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.ar8&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.ReportBinariesStreamer, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.ActiveReport&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.CompiledReportHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.rpx&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.RpxHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.rdl,*.rdlx&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.RdlxHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.ar8Web&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.WebCacheAccessHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;/httpHandlers&gt;
&lt;/system.web&gt;


 

&lt;system.webServer&gt;
&lt;validation validateIntegratedModeConfiguration=&quot;false&quot; /&gt;
&lt;handlers&gt;
&lt;add name=&quot;AR8Rpx&quot; path=&quot;*.rpx&quot; verb=&quot;*&quot; modules=&quot;IsapiModule&quot; scriptProcessor=&quot;%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll&quot; /&gt;
&lt;add name=&quot;AR8Rdlx&quot; path=&quot;*.rdlx&quot; verb=&quot;*&quot; modules=&quot;IsapiModule&quot; scriptProcessor=&quot;%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll&quot; /&gt;
&lt;add name=&quot;AR8Rdl&quot; path=&quot;*.rdl&quot; verb=&quot;*&quot; modules=&quot;IsapiModule&quot; scriptProcessor=&quot;%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll&quot; /&gt;
&lt;add name=&quot;AR8&quot; path=&quot;*.ar8&quot; verb=&quot;*&quot; modules=&quot;IsapiModule&quot; scriptProcessor=&quot;%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll&quot; /&gt;
&lt;add name=&quot;AR8Web&quot; path=&quot;*.ar8Web&quot; verb=&quot;*&quot; modules=&quot;IsapiModule&quot; scriptProcessor=&quot;%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll&quot; /&gt;
&lt;add name=&quot;ActiveReport&quot; path=&quot;*.ActiveReport&quot; verb=&quot;*&quot; modules=&quot;IsapiModule&quot; scriptProcessor=&quot;%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll&quot; /&gt;
&lt;/handlers&gt;
&lt;/system.webServer&gt;


An important thing to take into account is the version of ActiveReports 8 should match the one being used in the application and the .NET framework version should be correct. A sample web.config file can be downloaded from the download link below:

Integrated Pipeline Mode

You need to add the following handler mappings for Integrated Pipeline Mode:

&lt;system.web&gt;
&lt;httpHandlers&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.asmx&quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; validate=&quot;false&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.ar8&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.ReportBinariesStreamer, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.ActiveReport&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.CompiledReportHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.rpx&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.RpxHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.rdl,*.rdlx&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.RdlxHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.ar8Web&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.WebCacheAccessHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; /&gt;
&lt;/httpHandlers&gt;
&lt;/system.web&gt;

&lt;system.webServer&gt;
&lt;validation validateIntegratedModeConfiguration=&quot;false&quot; /&gt;
&lt;handlers&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.asmx&quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&quot; name=&quot;AsmxHandler&quot; resourceType=&quot;Unspecified&quot; preCondition=&quot;integratedMode&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.ar8&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.ReportBinariesStreamer, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; name=&quot;AR8_ReportBinariesStreamer&quot; resourceType=&quot;Unspecified&quot; preCondition=&quot;integratedMode&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.ActiveReport&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.CompiledReportHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; name=&quot;AR8_CompiledReportHandler&quot; resourceType=&quot;Unspecified&quot; preCondition=&quot;integratedMode&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.rpx&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.RpxHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; name=&quot;AR8_RpxHandler&quot; resourceType=&quot;Unspecified&quot; preCondition=&quot;integratedMode&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.rdl,*.rdlx&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.RdlxHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; name=&quot;AR8_RdlxHandler&quot; resourceType=&quot;Unspecified&quot; preCondition=&quot;integratedMode&quot; /&gt;
&lt;add verb=&quot;*&quot; path=&quot;*.ar8Web&quot; type=&quot;GrapeCity.ActiveReports.Web.Handlers.WebCacheAccessHandler, GrapeCity.ActiveReports.Web.v8, Version=8.1.414.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff&quot; name=&quot;AR8_WebCacheAccessHandler&quot; resourceType=&quot;Unspecified&quot; preCondition=&quot;integratedMode&quot; /&gt;
&lt;/handlers&gt;
&lt;/system.webServer&gt;


A sample web.config file can be downloaded from the download link below:


So this brings us to the end. Please note that the above entries are tested on a 32 bit machine and are meant to be used on a machine with similar OS configuration.