9

I'm trying to open an ssrs report on my web pages using ReportViewer. For the Report Serverl URL I have:

http://db_servers/ReportsServer_SENSORSQLSERVER

and for my report path I have:

http://db_servers/ReportsServer_SENSORSQLSERVER/Pages/ReportViewer.aspx?%2fCustomer1&rs:Command=Render.

I have looked through many sites and tutorial on how to add URL but I still get an error saying: The length of my link must be below 260 characters long. (rsInvalidItemPath). I also want to mention that my report server is in Native mode. My report server is located in another computer so I made sure the processing mode on my report viewer is remote. Whenever I go to the surver url I can clearly see the list of my reports and when I click on a report I can see it as well so I know my urls are correct. I have tried including a slash in front of my report path url, replacing "2%f" with a space. Nothing seems to work. Any idea? Thanks.

Rick
  • 397
  • 3
  • 12
  • 23

3 Answers3

13

You need to separate out the URL to the server, report path and add the parameters to a parameters array.

Here's a sample:

    protected void Page_Init(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        // Set the processing mode for the ReportViewer to Remote
        reportViewer.ProcessingMode = ProcessingMode.Remote;

        ServerReport serverReport = reportViewer.ServerReport;

        // Set the report server URL and report path
        serverReport.ReportServerUrl =
            new Uri("http://<Server Name>/reportserver");
        serverReport.ReportPath =
            "/AdventureWorks Sample Reports/Sales Order Detail";

        // Create the sales order number report parameter
        ReportParameter salesOrderNumber = new ReportParameter();
        salesOrderNumber.Name = "SalesOrderNumber";
        salesOrderNumber.Values.Add("SO43661");

        // Set the report parameters for the report
        reportViewer.ServerReport.SetParameters(
            new ReportParameter[] { salesOrderNumber });
    }
}

Above taken from Using the WebForms ReportViewer Control.

Kevin LaBranche
  • 20,908
  • 5
  • 52
  • 76
  • 1
    thanks for your response. I tried the above and I still got an error saying: "the item folder/reportname cannot be found. (rsItemNotFound) – Rick Sep 26 '12 at 18:49
  • I'm not sure you have the correct path for the report. It should look something like /report folder/report name.... What you have in your sample appears to be the path pasted in from the report server GUI.... If your report is in a folder called for example MySales and inside that the report is named Sales2012 then you would want the reportpath to be /MySales/Sales2012. – Kevin LaBranche Sep 26 '12 at 18:58
2

You should replace the "2%f" by "/".

The problem is with your ReportPath property, e.g:

%2fCustomer1 -> /Customer1

Tshilidzi Mudau
  • 7,373
  • 6
  • 36
  • 49
Daniel
  • 455
  • 4
  • 14
1

This is an old one but I bumped into it for a client. To get the report URL, I found it easiest to connect to the SQL instance that the Report Server is running on via SSMS, then open the ReportServer database, and query the Catalog table for the path fields.

Greg Sipes
  • 683
  • 6
  • 16