title: Passing parameters to remote SSRS report from ASP.NET MVC application
body: <p>I have an ASP.NET MVC application that uses SSRS for reporting (using a web form and report viewer). I would like to pass two parameters dynamically to the remote report. My current implementation stores the parameters in session, which works fine on VS Development Server, but the variable is null on IIS, upon retrieval in the web form.</p>
  
  <p>Here is the controller method that calls the view</p>
  
  <pre><code>    public ActionResult ShowReport(string id)
      {
          var reportParameters = new Dictionary&lt;string, string&gt;();
          reportParameters.Add("Param1", id);
          reportParameters.Add("Param2", "user1");
          Session["reportParameters"] = reportParameters;
  
          return View("ReportName");
      }
  </code></pre>
  
  <p>And here is how I attempt to retrieve the parameters from the web form</p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
      {
          var reportParameters = (Dictionary&lt;string, string&gt;)Session["reportParameters"];
  
          foreach (var item in reportParameters)
          {
              ReportParameter rp = new ReportParameter(item.Key, item.Value);
              ReportViewer1.ServerReport.SetParameters(rp);
          }
      }
  </code></pre>
  
  <p>Anyone know why Session["reportParameters"] is null?
  Or is there some other way of passing these parameters?</p>