Asp.net 有关以编程方式将数据发布到另一个aspx页面的问题
基本上,我必须创建像test.aspx和test1.aspx这样的页面。test.aspx有一个按钮,当单击按钮时,将调用一个例程,该例程将以编程方式将数据发布到test1.aspx页面,test1.aspx页面将显示数据 下面是test.aspx页面的代码 下面是test1.aspx页面的代码Asp.net 有关以编程方式将数据发布到另一个aspx页面的问题,asp.net,Asp.net,基本上,我必须创建像test.aspx和test1.aspx这样的页面。test.aspx有一个按钮,当单击按钮时,将调用一个例程,该例程将以编程方式将数据发布到test1.aspx页面,test1.aspx页面将显示数据 下面是test.aspx页面的代码 下面是test1.aspx页面的代码 我只是不明白我的代码中有什么错误,结果数据没有发布到那个页面。基本上,我希望当用户单击test.aspx中的按钮时,数据将以编程方式从test.aspx页面发布到test1.aspx页面,并且test1
我只是不明白我的代码中有什么错误,结果数据没有发布到那个页面。基本上,我希望当用户单击test.aspx中的按钮时,数据将以编程方式从test.aspx页面发布到test1.aspx页面,并且test1.aspx将在浏览器中显示发布的数据。请指导我需要在我的代码中更改什么,以满足我的要求。谢谢我想你让事情变得比实际情况更困难了。以下是一些其他选项: 为什么不响应呢?重定向到Button1\u Click方法中的test1.aspx,并在查询字符串中传递这两个参数 或者,如果您不希望在GET请求中完成工作,为什么不将test1.aspx中的代码移动到Button1\u Click方法中,然后在完成后重定向到test1.aspx
或者,为什么不跨页面发回test1.aspx(尽管跨页面发回依赖于javascript)?我不能将数据作为查询字符串发送。指导我如何将数据发送到另一个页面以及该页面的重定向。基本上,我需要重定向用户到贝宝网站连同数据。所以当用户看到paypal页面时,用户会看到paypal站点中已经填充了一些数据。所以,请指导我如何将用户重定向到paypal站点以及数据,这样当页面加载时,数据将填充到paypal站点。我以前没有使用过paypal,但这里有一个指向paypal开发文档的链接,可能会很有用,
protected void Button1_Click(object sender, EventArgs e)
{
PostForm();
}
private void PostForm()
{
WebRequest request = WebRequest.Create("http://localhost:14803/PaypalCSharp/Test1.aspx");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
string postContent = string.Format("parameter1={0}¶meter2={1}", "Hello", "Wow");
byte[] postContentBytes = Encoding.ASCII.GetBytes(postContent);
request.ContentLength = postContentBytes.Length;
Stream writer = request.GetRequestStream();
writer.Write(postContentBytes, 0, postContentBytes.Length);
writer.Close();
}
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
string str1 = Request.Form["parameter1"];
string str2 = Request.Form["parameter2"];
}
}