该功能存在于pageB.aspx中,并且参数从pageA传递。我无法得到pageB的结果。这里应该做些什么。如何从另一页获取数据
pageA.aspx.cs:
string URI = Server.MapPath("~/pageB.aspx");
NameValueCollection UrlParams = new NameValueCollection();
UrlParams.Add("section", "10");
UrlParams.Add("position", "20");
using (WebClient client = new WebClient())
{
byte[] responsebytes = client.UploadValues(URI, "POST", UrlParams);
string responsebody = Encoding.UTF8.GetString(responsebytes);
}
当编译器读取字节[],存在其中询问是否应当改变到页面B制成的对话框。点击否,没有任何反应。字符串'responsebody'是空的。
pageB.aspx.cs ::
protected void Page_Load(object sender, EventArgs e)
{
if (int.TryParse(Request.QueryString["section"], out section)
&& int.TryParse(Request.QueryString["position"], out position))
{
ProcessData();
}
}
private string ProcessData()
{
string HTMLContent = string.Empty;
try
{
//some code to render the string.
return HTMLContent;
}
catch (Exception ex)
{
throw ex;
}
}
我想从页面B
无法为此项目使用会话变量。 “ – Qwerty
”无法为此项目使用会话变量。“为什么不? – lahsrah
承载相同页面的多台服务器。因此建议不要全部通过。 – Qwerty