0
votes

I'm working with an ASP.Net page which displays reports from a remote SSRS server using the ReportViewer control. It was working without problems until we deployed a new report which doesn't require/accept any parameters. When rendering these reports, the first page of the report would render fine but when you switch to another page (using the controls from ReportViewer) you get an error saying, "One or more data sources is missing credentials".

enter image description here

This is how the ReportViewer is being configured...

this.Report.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
this.Report.ServerReport.ReportServerUrl = new Uri(App.Config.ReportServerPath);
this.Report.ServerReport.ReportPath = this.ReportPath;
this.SetRerportParameterValues(); // This does nothing since the report doesn't have any parameters
this.Report.AsyncRendering = false;

If I change the AsyncRendering to true, the error will be displayed when rendering the first page of the report.

When rendering a report, which doesn't have any parameters, is there something different I have to do with the parameters?

2
Curious if you just run the report from the SSRS report builder, do you also get the error? So nothing really wrong with your code, it's just that when the report was developed it's using windows auth and the developer can run it but when you run it from the application it is not getting the credentials past to access the data sources?Jesse
The report runs fine when run directly from the report server. The web application is run as a service account and that service account has the necessary permission. I've also, unsuccessfully, run it using my account (full access). Also, if this were they case, why would still render the first page? The report is using a shared data source and other reports are working fine with the same data source. This problem only seems to occur for reports which don't have any parameters. I haven't tried yet, but I'm sure if I added a useless parameter to the report definition that it would work.nitedmn
The report runs fine everywhere except when it try to load it into my custom asp.net wrapper page. Even then, the first page will render fine. It only fails when I try to switch to another page. If I use one of the download links to download the the report, I will get all the data.nitedmn

2 Answers

0
votes

Better you remove

this.SetRerportParameterValues();

As this seems to do nothing.

And, are you sure there aren't any sub-reports in this very report ? If yes, you may need to check for its query/data source etc.

EDIT

There are some known issues with the reportviewer control. I personally take the reportviewer as only the basic viewer when designing the reports, as from User perspective reportViewer is not the best option, due to some issues.
So, in order to get the report data output to be shown to user, it is a better option to convert report to PDF on the fly from code behind, and show the PDF to the user.

0
votes

I'm still not exactly sure why this is occurring but I did find the cause and was able to resolve it.

My ASPX page was inheriting from a custom page base (which inherited System.Web.UI.Page). The initialization of the base page was looping through all HTML controls on the page and attaching a simple handler to the change event. The event handler would simply add the control to a list when it's value was modified. This event handler is pretty simple and looks like this...

 private void HtmlCtrl_ServerChange(object sender, EventArgs e)
    {
        HtmlControl ctrl = sender as HtmlControl;
        if (ctrl != null)
        {
            this.changedControls.Add(ctrl);
        }
    }

For some reason, I'm still not sure why, this functionality messed up the ReportViewer control when you tried to navigate to the second page of a report with zero parameters. To resolve this I just added an additional property to my base page class which allows me to disable the change tracking functionality since it's not needed on this page anyway.