参考
http://dotnet.aspx.cc/ShowDetail.aspx?id=ATV1GLXT-65FF-4M82-CT5U-B1J65D3ZN2OK

解决方案 »

  1.   

    思路不同的,你是先post然后重定向过去,这是2个动作,和直接用?重定向过去有不同的,
    得到的页面看上去什么反应也没有的
      

  2.   

    我把你的代码改了一下:
    string postData = "SPID=sewqr" ;
          string strUrl = "http://localhost/test/WebForm1.aspx";
          byte[] data = encoding.GetBytes(postData);
    ..............
    Response.Redirect("http://localhost/test/WebForm1.aspx");
    ------------------------------------
    WebForm1.aspx的代码是
    string id="0";
    if (Request.Form["SPID"]==null)
    {id="";}
    else
    {
    //id=Request.QueryString["SPID"];
    id=Request.Form["SPID"];
    }
    TextBox1.Text=id.ToString();
    Label1.Text=id.ToString();什么反应都没?
      

  3.   

    如果post以后不需要管接受页面的话,估计你的代码可以用
    问题是需要显示接受参数的页面就麻烦了
      

  4.   

    WebForm2:
    private void Button1_Click(object sender, System.EventArgs e)
    {
    Context.Items["ACTION"]   = "http://localhost/test/WebForm1.aspx";
    Context.Items["SPID"]= "1234567!"; Server.Transfer("Webform3.aspx",true);
    }
    WwbForm3:
    -------------------
    <%@ Page language="c#" Codebehind="WebForm3.aspx.cs" AutoEventWireup="false" Inherits="test.WebForm3" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <html>
    <head>
    <title>WebForm3</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </head>
    <body MS_POSITIONING="GridLayout">
    <form id="WebForm3" method="post" action = "<%=Context.Items["ACTION"].ToString()%>">
    <input name="SPID" type="hidden" ID="SPID" value="<%=Context.Items["SPID"].ToString()%>">
    </form>

    <script language =javascript>

    window.WebForm3.submit();

        </script>
    </body>
    </html>
    ----------------------------
    WebForm1(接受页)
                              if (Request.Params["SPID"]==null)
    {id="";}
    else
    {
    id=Request.Params["SPID"];

    } TextBox1.Text=id.ToString();
    Label1.Text=id.ToString();