'C# MVC Download SSRS Report as PDF File passing Parameter data as Post Request

I've set up a short test for creating a SSRS report and Downloading it as PDF via an MVC Website.

private static string _report = @"http://myServer/ReportServer?/Test&s:Command=Render&rs:Format=pdf&Param1={0}&Param2={1}";

public FileResult DownloadReport() {
    using (var client = new WebClient()) {
        client.Credentials = CredentialCache.DefaultCredentials;
        var data = client.DownloadData(String.Format(_report, "MyParam1Value", "MyParam2Value");
        return File(data, "application/pdf", "YourReport.pdf");
    }
}

This is working fine so far.

But for the Report im planning to do i will have a lot of Parameters with large data. So im worried that im reaching the maximum lenght of the URL. Is there a way to pass the Parameter data as POST request, so that its not in the URL?

Thank you all



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source