How can I download a report? Credential problem

0

I'm trying to download a report (SSRS). More specifically I want to save it in a folder to be able to print it.

It turns out that in development I do not have any problems downloading the report. But at the very least I have to specify that I want to use the credentials by default:

using (var client = new WebClient())
{
    client.UseDefaultCredentials = true;
}

However when I try to publish the application to the IIS server I have to specify the credentials (username, password), otherwise I get an Error 403 Forbidden or 401 Unauthorized :

client.Credentials = new NetworkCredential("username", "password");

In my perspective, the IIS Application Pool user should have sufficient permissions to download the report, since I have it too.

This is my current code, without the print part.

public string Print(string reportUri, string printerName)
{
    using (var client = new WebClient())
    {
        var path = Path.ChangeExtension(Path.GetTempFileName(), "pdf");

        client.UseDefaultCredentials = true;
        client.DownloadFile(reportUri, path);

        return path;
    }
}

What do I have to do to download the production report without specifying the credentials?

    
asked by anonymous 10.08.2016 / 11:17

1 answer

0

My report server and application server were not the same. (I think) that for this reason the IIS user did not have permissions to read the report.

The solution was to use a common user to both servers (because they are in the same domain) and have read access to the reports. You must also configure the application pool user to use that same user.

    
10.08.2016 / 13:23