Asp.net 将参数从MVC4操作发送到SSRS报告的Web表单
我在mvc4 web应用程序中使用SSRS报告Asp.net 将参数从MVC4操作发送到SSRS报告的Web表单,asp.net,asp.net-mvc-4,reporting-services,Asp.net,Asp.net Mvc 4,Reporting Services,我在mvc4 web应用程序中使用SSRS报告使用web表单(其中的reportviewer服务器端控件)和视图(包含iFrame)。 我正在使用会话从我的操作向报告发送参数 这是我的代码。 控制器动作代码 public ActionResult GetParamReport() { HttpContext.Session.Add("param","a"); Redirect("~/Contents/Reports/ReportParameter.
使用web表单(其中的reportviewer服务器端控件)和
视图(包含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();
}
由于我不想使用会话,是否还有其他方法可以发送会话以外的参数。最好将其作为查询字符串传递:
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"];
}
你考虑过用QuielStudio发送它吗?@ SelaGy,当然,我没有考虑如何通过QuestScript到ASPX,同时我想返回我的ViWi想要返回我的视图,不管怎样,我尝试了上面的解决方案,这在“//”应用程序中给了一个错误的服务器错误。找不到资源。在这种情况下,返回您的视图(
return view()
),并在此视图中使用一个带有src
属性的,该属性指向您的aspx页面-src=“@Url.Content(“~/Contents/Reports/ReportParameter.aspx”)?param=@HttpUtility.UrlEncode(“some value”)”
。我已经这样做了,我在问题中提到过,我在这里关心的是我想从viewSure向我的aspx发送参数,在指定iframe的src时,您可以将它们作为查询字符串参数传递。您能告诉我如何传递我的操作方法吗?我从用户那里获取视图中的参数,然后在操作方法中获取参数,然后我需要将其传递到web表单页面加载