0

私は、
Webフォーム(レポートビューアーサーバー側のコントロール)と
ビュー(iFrameを含む)を使用して、mvc4 WebアプリケーションでSSRSレポートを使用しています。セッションを使用してアクションからレポートするパラメータを送信しています。これが私のコードです。
コントローラのアクション コード

    public ActionResult GetParamReport()
    {
        HttpContext.Session.Add("param","a");
        Redirect("~/Contents/Reports/ReportParameter.aspx");
        return View("ParamReport");
    }

aspxのページロードで、次を使用してアクセスします

    protected void Page_Load(object sender, EventArgs e)
    {

        string Parameter = HttpContext.Current.Session["param"].ToString(); 
    }

セッションを使用したくないため、セッション以外のパラメーターを送信する他の方法はありますか。

4

1 に答える 1

0

クエリ文字列として渡すことは、反抗的に好まれます。

public ActionResult GetParamReport()
{
    return Redirect("~/Contents/Reports/ReportParameter.aspx?param=" + HttpUtility.UrlEncode("some value"));
}

その後:

protected void Page_Load(object sender, EventArgs e)
{
    string parameter = Request["param"]; 
}
于 2013-02-25T14:15:04.970 に答える