you can use post to send requests to other pages and get the results returned. You can send a post to another page from one page, or you can use HttpRequest to send a post to a page in a WinForm project. Let's take an example from an ASPX page of ASP. Post.aspx from an ASPX page, sending a request to the Receive.aspx page. 1first, build the project, add two pages, post.aspx and receive.aspx put a button in the Post page, and in its click Method we can write a piece of code like this:Private voidButton1_Click (Objectsender, System.EventArgs e) {//XML file path stringXMLfileName = Server.MapPath ("File/frame.xml"); HttpWebRequest req=NULL; Try { //set the URL of the page to post to, here the Chinese parameters or have special symbols, to be encoded. stringURL ="http://localhost/Receive.aspx"+"? Dwgfilename="+httputility.urlencode ("nnn+10111452505252706++2.bmp,nnn+10111457375757706++13.bmp")+"&pltfilename="+httputility.urlencode ("nnn+10110934363434706++ home page. JPG"); //Create a HttpWebRequest objectreq =(HttpWebRequest) httpwebrequest.create (URL); //set the way it submits data postReq. Method ="POST"; //set the value of the Content-type HTTP headerReq. ContentType ="Text/xml";//"application/x-www-form-urlencoded;charset=gb2312"; using(StreamWriter Requestwriter =NewStreamWriter (req. GetRequestStream ())) {//defines a StreamReader object that reads the contents of an XML fileStreamReader reader =NewStreamReader (XMLfileName); stringRET =Reader. ReadToEnd (); Reader. Close (); Requestwriter.writeline (ret);//writes the read content to the Requeststream. } Response.Write ("sent to the"); } Catch(Exception ex) {Throwex; } finally{ }}2. Take a look at the receive page receive.aspx the request to receive a post from the Pageload method in the Receive.aspx page. Private voidPage_Load (Objectsender, System.EventArgs e) { if(Request.requesttype = ="POST") { //Response.ContentType = "Text/xml"; stringPltfilename = request.querystring["Pltfilename"];//plt file name stringDwgfilename = request.querystring["Dwgfilename"];//DWG file Name list: 111.dwg,222.dwg,333.dwg .....//receives and reads the XML file stream from the post.StreamReader reader =NewStreamReader (Request.inputstream); String XmlData=Reader. ReadToEnd (); Try { //declares a xmldoc document object, LOAD () XML stringXmlDocument doc =NewXmlDocument (); Doc. LOADXML (XmlData); //get the XML document root nodeXmlElement root =Doc. DocumentElement; ..... Do your own work on the XML ... }
Apply post to send and receive XML files and parameters in ASP. Go