Post method to visit the site, note that: Post must be capitalized, or reported 403 errors.
For ASPX Web pages, be sure to note that ViewState, if not post viewstate, the background program will not be processed.
HttpWebRequest myHttpWebRequest =
(HttpWebRequest) WebRequest.Create ("http://192.168.31.20/action/WebForm1.aspx");
Myhttpwebrequest.method= "POST";
String Postdata= "textbox1=" +textbox1.text;
System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding ();
Byte[] byte1=encoding. GetBytes (PostData);
Myhttpwebrequest.contenttype= "application/x-www-form-urlencoded";
Myhttpwebrequest.contentlength=postdata.length;
System.IO.Stream Newstream;
Newstream=myhttpwebrequest.getrequeststream ();
Newstream.write (byte1,0,byte1. Length);
Newstream.close ();
System.Net.WebResponse Wresp =myhttpwebrequest.getresponse ();
System.IO.Stream Respstream = Wresp.getresponsestream ();
System.IO.StreamReader reader = new System.IO.StreamReader (Respstream,
System.Text.Encoding.GetEncoding ("gb2312"));
Textbox2.text=reader. ReadToEnd ();
Respstream.close ();
Reader. Close ();