由于对方通过form的post方式发送参数到处理页面settle.aspx。然后处理完毕之后还需要连接到另一个页面上other.aspx。同时需要传递参数,由于没有人工干预,则在settle.aspx的page_login中应该处理参数然后立即转至other.aspx。如果通过Request.redirect("other.aspx?param1=1&param2=2"),则传递参数的方式就是get的了,那么应该如何实现可以以post方式传递参数给other.aspx呢?谢谢!!

解决方案 »

  1.   

    Server.Transfer();
    应该可以。
      

  2.   

    <form method="post" action="other.aspx" name="form1">
    <input type="hidden" value="1" name="parm1">
    <input type="hidden" value="2" name="parm2">
    </form>
    <script>
    document.all.form1.submit();
    </script>
      

  3.   

    最后使用了WebClient方式实现了。private void Button1_Click(object sender, System.EventArgs e)
    {
      TextBox1.Text = readHtmlPage("http://localhost/ReturnUrl.aspx");
    }private String readHtmlPage(string url)
    {
      String result = "";
      String strPost = "x=1&y=2&z=YouPostedOk";
      StreamWriter myWriter = null;  HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
      objRequest.Method = "POST";
      objRequest.ContentLength = strPost.Length;
      objRequest.ContentType = "application/x-www-form-urlencoded";
      try
      {
         myWriter = new StreamWriter(objRequest.GetRequestStream());
         myWriter.Write(strPost);
       }
       catch (Exception e) 
       {
          return e.Message;
       }
       finally 
       {
          myWriter.Close();
       }
             
       HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
       using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()) )
       {
          result = sr.ReadToEnd();
          // Close and clean up the StreamReader
          sr.Close();
        }    return result;
    }