Sirus
Sirus

Reputation: 502

how to link to ssrs report from asp.net webpage

I'm having trouble linking to an ssrs report from my asp.net webpage. the direct link is

server/Reports/Pages/Report.aspx?ItemPath=%2fRig+Dashboard%2fRig+Status+Report

I also need to pass in two parameters which is FileTypeID and Date

ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
        ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://server/Reports"); // Report Server URL
        ReportViewer1.ServerReport.ReportPath = "/Rig Dashboard/Rig Status Report"; // Report Name
        ReportViewer1.ShowParameterPrompts = false;
        ReportViewer1.ShowPrintButton = true;
 ReportViewer1.ServerReport.Refresh();


 The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.
 The request failed with HTTP status 404: Not Found.

Upvotes: 1

Views: 3541

Answers (1)

djangojazz
djangojazz

Reputation: 13242

Your doing it wrong. You are trying to call the 'landing page' : /Reports NOT THE SERVICE: /ReportServer. Yuriy gave you a good place to get started. I can give you an example of how I do it in some local code I use in WPF calling a Windows Form(blech!):

private void ResetReportViewer(ProcessingMode mode)
        {
            this.reportViewer.Clear();
            this.reportViewer.LocalReport.DataSources.Clear();
            this.reportViewer.ProcessingMode = mode;
        }

        private void ReportViewerRemote_Load(object sender, EventArgs e)
        {
            ResetReportViewer(ProcessingMode.Remote);
            reportViewer.ServerReport.ReportServerUrl = new Uri(@"http://server/ReportServer");
            reportViewer.ServerReport.ReportPath = "/Folder/ReportName";

            reportViewer.RefreshReport();
        }

        private void ReportViewerRemoteWithCred_Load(object sender, EventArgs e)
        {
            ResetReportViewer(ProcessingMode.Remote);
            reportViewer.ServerReport.ReportServerUrl = new Uri(@"http://server/ReportServer");
            reportViewer.ServerReport.ReportPath = "/Folder/ReportName";

            DataSourceCredentials dsCrendtials = new DataSourceCredentials();
            dsCrendtials.Name = "DataSource1";
            dsCrendtials.UserId = "DedicatedUser";
            dsCrendtials.Password = "P@ssword(jk)";
            reportViewer.ServerReport.SetDataSourceCredentials(new DataSourceCredentials[] { dsCrendtials });

            reportViewer.RefreshReport();
        }

Upvotes: 1

Related Questions