0

我在我的 mvc4 Web 应用程序中使用 SSRS 报告,
使用 Web 表单(其中的报表查看器服务器端控件)和
视图(包含 iFrame)。我正在使用会话发送参数以报告我的操作,这是我的代码。
控制器动作代码

    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 回答