在Page_Load里面,如果有个变量变了值,我怎么post到另外一个页面(在另外的域里),只能用post方法,用request.Form接受

解决方案 »

  1.   

    string uriString;
    Console.Write("\nPlease enter the URI to post data to {for example, http://www.contoso.com} : ");
    uriString = Console.ReadLine();
    // Create a new WebClient instance.
    WebClient myWebClient = new WebClient();
    Console.WriteLine("\nPlease enter the data to be posted to the URI {0}:",uriString);
    string postData = Console.ReadLine();
    myWebClient.Headers.Add("Content-Type","application/x-www-form-urlencoded");
    // Apply ASCII Encoding to obtain the string as a byte array.
    byte[] byteArray = Encoding.ASCII.GetBytes(postData);
    Console.WriteLine("Uploading to {0} ...",  uriString);                        
    // Upload the input string using the HTTP 1.0 POST method.
    byte[] responseArray = myWebClient.UploadData(uriString,"POST",byteArray);
    // Decode and display the response.
    Console.WriteLine("\nResponse received was {0}",
        Encoding.ASCII.GetString(responseArray));
      

  2.   

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

  3.   

    我只能用传统的post的方法,用request.form["name"]来接受,并要把数据显示在接受页面