2

I have ssrs report viewer url and tried directly convert to pdf :

http://someIP/Reports_Server/Pages/Report.aspx?ItemPath=%2fReport+Folder%2fReport+Name&Parameter=parametervalue&rs:Command=Render&rs:Format=PDF

If I tried to access it in browser, it did not render to pdf, and parameter not passed. I did something like this in mvc 5 :

 public ActionResult GetPdfReport()
    {
        NetworkCredential nwc = new NetworkCredential("username", "password");
        WebClient client = new WebClient();
        client.Credentials = nwc;

        string reportURL = "http://someIP/Reports_Server/Pages/Report.aspx?ItemPath=%2fReport+Folder%2fReport+Name&Parameter=parametervalue&rs:Command=Render&rs:Format=PDF";


        return File(client.DownloadData(reportURL), "application/pdf", "filename.pdf");
    }

Anyone any idea?

Prast
  • 41
  • 1
  • 7

1 Answers1

0

I've successfully got PDF report from our SSRS system via browser URL. I used next URL:

http://serverAddress/reportServer?/report_folder/report_name/&rs:Command=Render&rs:Format=PDF&rc:Toolbar=false&rc:Parameters=false&client_id=107

where client_id is report parameter.

fabulaspb
  • 1,238
  • 8
  • 9
  • can i have example to define report folder and report name in the url? because I do not know much about ssrs – Prast Jan 08 '16 at 07:35
  • Off course, in my case it: `/egger/slow_mover/` where egger is folder name, slow_mover - report name – fabulaspb Jan 08 '16 at 08:00
  • I have tried many times, but it's always redirect to viewer aspx :( – Prast Jan 08 '16 at 08:05
  • this is my url : `http://IPServer/Reports_Server?/Report+ARIA/MI/MI+-+PMNInstitusi/&rs:Command=Render&rs:Format=PDF&rc:Toolbar=false&rc:Parameters=false&NoAktifitas=20151028000007` – Prast Jan 08 '16 at 08:08
  • Are you sure that SSRS web service URL is Reports_Server not reportServer? – fabulaspb Jan 08 '16 at 08:25
  • I dont know much about that, this is my report server : `Reports_IDSQL2012` – Prast Jan 08 '16 at 08:28
  • You can find extra infromation here: https://msdn.microsoft.com/en-US/en-en/library/bb630447(v=sql.120).aspx about SSRS web service configuring – fabulaspb Jan 08 '16 at 08:29
  • Look here : "When you access a report server or Report Manager through its URL, the URL should include the host name and not the IP address. On a TCP/IP network, the IP address will resolve to a host name (or the network name of the computer). If you used the default values to configure URLs, you should be able to access the Report Server Web service using URLs that specify the computer name or localhost as the host name: `http:///reportserver` `http://localhost/reportserver"` – fabulaspb Jan 08 '16 at 08:30
  • So I've tried access to web service via IP address of server and didn't have success. – fabulaspb Jan 08 '16 at 08:35
  • I think you have redirect because url of your web service is not valid – fabulaspb Jan 08 '16 at 08:36
  • So, your URL have to look like this: `http://Reports_IDSQL2012/reportServer?/Report+ARIA/MI/MI+-+PMN/&rs:Command=Render&rs:Format=PDF&rc:Toolbar=false&rc:Parameters=false&NoAktifitas=20151028000007` – fabulaspb Jan 08 '16 at 08:40
  • Glad to hear this :) – fabulaspb Jan 08 '16 at 10:13