Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何通过HTTP Post向SSR发送参数值数组?_.net_Reporting Services - Fatal编程技术网

.net 如何通过HTTP Post向SSR发送参数值数组?

.net 如何通过HTTP Post向SSR发送参数值数组?,.net,reporting-services,.net,Reporting Services,我试图让SSR生成PDF格式的报告,并捕获字节流以将其保存到磁盘。如果我必须发送的唯一报表参数是单个值,那么这种方法可以很好地工作,但是如果我必须发送特定参数的值数组,那么这种方法就不再有效 下面的工作很好,因为我只发送一年值。通过用户界面,年份参数将是一个多选参数 string parameters = "rs:Command=Render&rs:format=PDF&Year=2018" byte[] paramHeader = Encodin

我试图让SSR生成PDF格式的报告,并捕获字节流以将其保存到磁盘。如果我必须发送的唯一报表参数是单个值,那么这种方法可以很好地工作,但是如果我必须发送特定参数的值数组,那么这种方法就不再有效

下面的工作很好,因为我只发送一年值。通过用户界面,年份参数将是一个多选参数

        string parameters = "rs:Command=Render&rs:format=PDF&Year=2018"
        byte[] paramHeader = Encoding.ASCII.GetBytes(parameters);
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URL);
        req.PreAuthenticate = true;
        req.Credentials = new System.Net.NetworkCredential(
            reportUser,
            reportUserPW,
            reportUserDomain);

        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        req.ContentLength = paramHeader.Length;

        using (var stream = req.GetRequestStream())
        {
            stream.Write(paramHeader, 0, paramHeader.Length);
        }

            HttpWebResponse HttpWResp = (HttpWebResponse)req.GetResponse();
            Stream fStream = HttpWResp.GetResponseStream();
            File.WriteAllBytes(JobId.ToString() + "\\employeeName.pdf", copyStreamToByteArray(fStream));
如果我将参数字符串更改为具有多年值,则会失败:

string parameters = "rs:Command=Render&rs:format=PDF&Year=2018,2017,2016"
当我使用Reports Services UI查看它如何使用Fiddler将参数发送到SSR时,我尝试查看web流量,但无法从中获得任何有用的信息。它看起来像是在某种ViewState字符串中编码的


如何在Post标题中发送给定SSRS参数的值数组?

要使此工作正常,只需对每个附加值重复此参数,如下所示:

string parameters = "rs:Command=Render&rs:format=PDF&Year=2018&Year=2017&Year=2016"