Wednesday, February 26, 2014

Report Viewer Control IE11

With the latest release of IE11 there have been some cool upgrades I would say in style of the dev tools (it would be cool if they did not time out on me) but there are some compatibility issues that I have ran into with a ReportViewer control on my web application. Each time I would try to render a .rdl file document via the controller the loading .gif would kick on and the report would time out on me. It appears I was not the only one.

Web Forms project
Server: IIS7 
Framework: 3.5
Microsoft Report Viewer 10.0.0.0
Visual Studio 2012


So searching around the web I found the usual suspects the first thing everyone was shouting on stack overflow was changing the rendering of IE to IE10 mode via meta tags in the head of the document. I'm not really a fan of this approach it's more of a band-aid solution then a fix. 

Then I tried using the dev tools on IE11 to see if I could narrow down the network traffic and see which requests were timing out and received no joy there. 

Finally I found the clue I was looking for to break this issue. I ran the request again while logged into the web server and checking the Event Viewer log. There I saw my failed attempt to pull the document. The event viewer logs read "HttpHandlerInputException, Missing URL parameter: IterationId."

After some searching I found that you could fix this missing parameter by adding some logic to your gobal.aspx file on your project as follows: 


It basically checks your request and if it is coming from your report viewer url performs another check to make sure that the parameter has a value and if not places the default zero value which will suffice the request and you will get your document. Experimenting with this issue I only found it in IE11 with the rest of the browser the rendering without this parameter was not an issue. It seems that IE is a little more picky on what it will allow to come through the system. I've found this with the rendering of CSS and html as well. I hope this post helps someone out there save some time. This was a 2 day easter egg hunt for myself. Always looking to pass this information along to my fellow coders. Also I've using this blog to document my fixes so later on when I run into this again I'll know where to start.