简体   繁体   中英

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

I have found a Solution, or workaround.. :-)

I will store all the data in a Db an just pass the id of the created record to the report.

It was for my usecase not neccessary to store the data in a Db, but its also not a problem.

If someone still would know how to pass the parameters via Post Request, then feel free to answer. Maybe someone else needs it.

Thank you all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM