Search code examples
c#asp.netasp.net-mvc-2reportviewerreportingservices-2005

MVC 2 and the reportviewer with SSRS 2005 - white page, no error


I am having an issue with my reportviewer where nothing is visible, not even the control. If I add other content, it shows, but the reportviewer is not. I am using the 9.0.0.0 version of the control with SSRS 2005 inside an MVC 2.0 application. I have built and deployed the report to the server. I have confirmed by looking on the report server and running it there.

  1. My app is MVC 2.0
  2. I have added a regular webforms page into the root of the website. I put it in a form, runat=server, and enabled viewstate
  3. I have added the .aspx routing exception
  4. My code behind is set up similarly to every example I can find
  5. My webconfig is configured (maybe that is where my issue is)
  6. I set up a manual test by forcing the correct values in and I get the same blank page.
  7. I have a reference to the 9.0.0.0 versions of Microsoft.ReportViewer.WebForms and Microsoft.ReportViewer.Common and as you can see my web.config matches my references.

The page appears white - no control is visible. No errors are thrown. As I remembered it, there should at least be a blank Reportviewer control on the page, however there isn't anything there at all.

A few other oddities - If I remove the parameter setting, no error occurrs. I also added code to send in credentials, but that did not work, even when sending in the credentials for the administrator account.

Report.aspx

<%@ Page Language="C#" AutoEventWireup="true" ViewStateMode="Enabled" CodeBehind="Report.aspx.cs" Inherits="MySite.Web.Report" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<html>
<body>
<form id="form1" runat="server">
<rsweb:ReportViewer ID="reportViewer" EnableViewState="True" runat="server" />
</form>
</body>
</html>

Routing Exceptions

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");

Code Behind

protected void Page_Load(object sender, EventArgs e)
{
    var qs = ReportQueryString.Parse(Request.QueryString["R"]);

    reportViewer.ServerReport.ReportServerUrl = ConfigurationHelper.Reports.ReportServerUrl;
    reportViewer.ServerReport.ReportPath = String.Format(ConfigurationHelper.Reports.ReportPath, qs.ReportName);

    var result = from p in qs.Parameters
                    select new ReportParameter(p.Key, p.Value);

    reportViewer.ServerReport.SetParameters(result);
    reportViewer.ServerReport.Refresh();
}

Web.config

<compilation debug="true" targetFramework="4.0">
  <assemblies>
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
  </assemblies>
    <buildProviders>
        <add type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" extension=".rdl" />
    </buildProviders>
</compilation>

  <pages>
      <namespaces>
          <add namespace="Microsoft.Web.Mvc" />
          <add namespace="System.Web.Mvc" />
          <add namespace="System.Web.Mvc.Ajax" />
          <add namespace="System.Web.Mvc.Html" />
          <add namespace="System.Web.Routing" />
          <add namespace="System.Drawing" />
      </namespaces>
  </pages>

  <httpHandlers>
      <add type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" path="Reserved.ReportViewerWebControl.axd" verb="*" />
  </httpHandlers>

EDIT:

As requested, here is the page source. On a side note, I am using Chrome, but I did try IE with the same result.

<html>

<body>

<form method="post" action="Report.aspx?R=rYeJ28xc7emx1PJPgiRkOi1lXjmmNE6pF7aJrEJ443w*" id="form1">

<div class="aspNetHidden">

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0NzMwNTUwMTgPZBYCAgEPZBYCAgEPFCsABA8WAh4OUmVuZGVyaW5nU3RhdGULKZUBTWljcm9zb2Z0LlJlcG9ydGluZy5XZWJGb3Jtcy5SZXBvcnRSZW5kZXJpbmdTdGF0ZSwgTWljcm9zb2Z0LlJlcG9ydFZpZXdlci5XZWJGb3JtcywgVmVyc2lvbj05LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2ECZCgpWFN5c3RlbS5HdWlkLCBtc2NvcmxpYiwgVmVyc2lvbj00LjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkkOTQ5NWQxOTEtMmVmMy00OTJlLTk1ZTgtMzRhZDBkYWI4ZGM4AgEUKwABFCsAAgIBZBYKZg8PFgIeB1Zpc2libGVoZGQCAQ8PFgIfAWhkFgICCA8PFgIfAWhkZAIGDxYCHgVWYWx1ZQUBMGQCBw8WAh8CBQVmYWxzZWQCCA8WAh8CBQVmYWxzZWRkvlE8tEXOwYRIWVLykp+GFwUxbrW+MAtpUdojqbM994U=" />

</div>





<script src="/Reserved.ReportViewerWebControl.axd?OpType=Resource&amp;Version=9.0.30729.4402&amp;Name=Microsoft.Reporting.WebForms.Scripts.ReportViewer.js" type="text/javascript"></script>

<div class="aspNetHidden">



    <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />

    <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />

    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBgLgrv+UCwL8sqiiBgL8sqyiBgL8srCiBgL8srSiBgL8stiiBkbkdSlUJxfVD65mS2OQpfO01z367cPQhXOdmZguuzmc" />

</div>

<div id="reportViewer" style="display:inline-block;height:400px;width:100%;">

    <Script language="javascript"><!--


if (document.getElementById('reportViewer') != null)

{

    document.getElementById('reportViewer').ClientController = new RSClientController("reportViewer_ctl03", "ReportFramereportViewer", "/Reserved.ReportViewerWebControl.axd?Mode=true&ReportID=b003c2a678b44c71b949617a693d4f8c&ControlID=9495d1912ef3492e95e834ad0dab8dc8&Culture=1033&UICulture=1033&ReportStack=1&OpType=DocMapArea&Controller=reportViewer&RootLabel=&BackColor=%23ECE9D8&Border=1px+Black+Solid&Font=font-family%3aVerdana%3bfont-size%3a8pt%3b", "25%", false, "/Reserved.ReportViewerWebControl.axd?Mode=true&ReportID=2558c6ccaa09444ea46bd3062bc553dd&ControlID=9495d1912ef3492e95e834ad0dab8dc8&Culture=1033&UICulture=1033&ReportStack=1&OpType=ReportArea&Controller=reportViewer&LinkTarget=_top", true, true, true, true, true, true, "reportViewer_ctl06", false, "\/Reserved.ReportViewerWebControl.axd?Mode=true&ReportID=66fb690f271c48d59bc881cd0f07421d&ControlID=9495d1912ef3492e95e834ad0dab8dc8&Culture=1033&UICulture=1033&ReportStack=1&OpType=Export&FileName=&ContentDisposition=OnlyHtmlInline&Format=", "PrintFramereportViewer", "\/Reserved.ReportViewerWebControl.axd?Mode=true&ReportID=c1c1698c78c7476b8a04e03424d3a36c&ControlID=9495d1912ef3492e95e834ad0dab8dc8&Culture=1033&UICulture=1033&ReportStack=1&OpType=PrintHtml", "reportViewer_ctl07", "reportViewer_ctl00", "reportViewer_ctl08");

    document.getElementById('reportViewer').ClientController.PostBackAction =

        function(actionType, actionParam)

        {

            document.getElementById("reportViewer_ctl04").value = actionType;

            document.getElementById("reportViewer_ctl05").value = actionParam;

            __doPostBack('reportViewer','');

        };

}
--></Script><input type="hidden" name="reportViewer$ctl04" id="reportViewer_ctl04" /><input type="hidden" name="reportViewer$ctl05" id="reportViewer_ctl05" /><input type="hidden" name="reportViewer$ctl06" id="reportViewer_ctl06" value="0" /><input type="hidden" name="reportViewer$ctl07" id="reportViewer_ctl07" value="false" /><input type="hidden" name="reportViewer$ctl08" id="reportViewer_ctl08" value="false" /><noscript>

        &nbsp;Your browser does not support scripts or has been configured not to allow scripts.

    </noscript><Script language="javascript"><!--


    document.getElementById('reportViewer').ClientController.CustomOnReportLoaded = function() {};

    document.getElementById('reportViewer').ClientController.CustomOnAsyncPageChange = function() {};

    document.getElementById('reportViewer').ClientController.CustomOnDocMapVisibilityChange = function() {};

    document.getElementById('reportViewer').ClientController.CustomOnPromptAreaVisibilityChange = function() {};

    document.getElementById('reportViewer').ClientController.CustomOnReloadDocMap = function() {};
--></Script>

</div><iframe name="reportViewerTouchSession0" id="reportViewerTouchSession0" onload="if (frames[&#39;reportViewerTouchSession0&#39;].location != &#39;javascript:\&#39;\&#39;&#39;) frames[&#39;reportViewerTouchSession0&#39;].location.replace(&#39;javascript:\&#39;\&#39;&#39;);" src="javascript:&#39;&#39;" style="position:absolute;width:0;height:0;border-width:0;visibility:hidden;">



</iframe><script type="text/javascript">

    setTimeout("frames['reportViewerTouchSession0'].location.replace('\\\/Reserved.ReportViewerWebControl.axd?Mode=true&ReportID=dd0df78cbe0d4c119d2af4e5a13a33b7&ControlID=9495d1912ef3492e95e834ad0dab8dc8&Culture=1033&UICulture=1033&ReportStack=1&OpType=SessionKeepAlive&TimerMethod=KeepAliveMethodreportViewerTouchSession0&CacheSeed=' + encodeURIComponent(Date()));", 0);function KeepAliveMethodreportViewerTouchSession0() {setTimeout("frames['reportViewerTouchSession0'].location.replace('\\\/Reserved.ReportViewerWebControl.axd?Mode=true&ReportID=dd0df78cbe0d4c119d2af4e5a13a33b7&ControlID=9495d1912ef3492e95e834ad0dab8dc8&Culture=1033&UICulture=1033&ReportStack=1&OpType=SessionKeepAlive&TimerMethod=KeepAliveMethodreportViewerTouchSession0&CacheSeed=' + encodeURIComponent(Date()));", 1140000);}

</script><Script language="javascript"><!--
document.getElementById('reportViewer').ClientController.ShowInitialWaitFrame();

--></Script>



<script type="text/javascript">

//<![CDATA[

var theForm = document.forms['form1'];

if (!theForm) {

    theForm = document.form1;

}

function __doPostBack(eventTarget, eventArgument) {

    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {

        theForm.__EVENTTARGET.value = eventTarget;

        theForm.__EVENTARGUMENT.value = eventArgument;

        theForm.submit();

    }

}

//]]>

</script>



</form>

</body>

</html>

Solution

  • In the event anyone else sees this, my problem was in how I defined the control on my page. I had to set the ProcessingMode attribute and then it worked like a champ.

    <rsweb:reportviewer ID="reportViewer" Width="100%" EnableViewState="True" 
        runat="server" ProcessingMode="Remote" />
    

    Hopefully someone else won't spend as long as I did trying to troubleshoot this issue.