Not much to say directly on the code
Public voidProcessRequest (HttpContext context) {context. Response.ContentType="Text/plain"; stringuristring ="http://127.0.0.1/tools/Handler1.ashx"; WebClient mywebclient=NewWebClient (); NameValueCollection mynamevaluecollection=NewNameValueCollection (); Mynamevaluecollection.add ("Name","Tom"); Mynamevaluecollection.add ("Address", uristring); Mynamevaluecollection.add (" Age"," A"); //Although it is an asynchronous call but also blocks the current response, it is still blocked from the effect, which is not the way I want it//You should use a background thread to do something like this.//This is not the same effect as the console show.mywebclient.uploadvaluescompleted + =mywebclient_uploadvaluescompleted; Mywebclient.uploadvaluesasync (NewUri (uristring),NULL, mynamevaluecollection, context); //Synchronous Post//byte[] Responsearray = Mywebclient.uploadvalues (uristring, mynamevaluecollection); //Decode and display the response. //Response.Write (Encoding.ASCII.GetString (Responsearray)); //context. Response.Write ("Hello World"); } voidMywebclient_uploadvaluescompleted (Objectsender, UploadValuesCompletedEventArgs e) {Octopus.Common.CommonHelper.TraceLog (Encoding.ASCII.GetString (E.result)); } //ReceiveContext. Response.ContentType ="Text/plain"; System.Threading.Thread.Sleep ( the); Context. Response.Write ("Hello World,"+ context. request.form["Name"] +","+ context. request.form[" Age"] +","+ context. request.form["Address"]);
Octopus series of uploadvalues asynchronous uploads