nhershko
nhershko

Reputation: 133

Get SSRS report as pure html for c# code

I'm trying to get SSRS repoert as html to open it on mobile device. I've added the relevant credentials to the HttpWebRequest object and success to get the result if I use the following patten URL:

http://APPserver.com/ReportServer/Pages/ReportViewer.aspx?/APP/APP%20Reports/RequestReport&ReportFormat=expandable&rc:Parameters=false&APPRequestId=c624561c-5f40-4545-8e13-d900c83449a8&rs:Command=Render&rs:Format=HTML4.0


This format gives me a lot of text but not the pure html that I need, so I've added parameter that clean the report file I got exacly what I need from browser but when I'm trying to get it from c# code i got 401 error.

the parameter is:

&rc:toolbar=false

As following:

http://APPserver.com/ReportServer/Pages/ReportViewer.aspx?/APP/APP%20Reports/RequestReport&ReportFormat=expandable&rc:Parameters=false&APPRequestId=c624561c-5f40-4545-8e13-d900c83449a8&rs:Command=Render&rs:Format=HTML4.0&rc:toolbar=false

I check this code from hte server himself with the administrator credentials but nothing works from code with this parameter.

Thanks! Naftali.

Upvotes: 0

Views: 1249

Answers (1)

nhershko
nhershko

Reputation: 133

I've found solution to the different between the browser and the code credentials. Using default network credentials gave me the same credentials as browser client:

request.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

instead of:

request.Credentials = request.Credentials = new NetworkCredential("user", "password");

apparently using the credentials stracture gives more needed data.

Thanks, Naftali.

Upvotes: 0

Related Questions