问题描述
发送网站页面<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="Default.aspx.cs"Inherits="WebApplication2._Default"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title>无标题页</title></head><body><formid="form1"runat="server"><div><asp:ButtonID="Button1"runat="server"OnClick="Button1_Click"Style="z-index:100;left:45px;position:absolute;top:69px"Text="Button"/><asp:TextBoxID="TextBox1"runat="server"></asp:TextBox><asp:TextBoxID="TextBox2"runat="server"></asp:TextBox></div></form></body></html>singSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingSystem.Xml;usingSystem.IO;namespaceWebApplication2{publicpartialclass_Default:System.Web.UI.Page{publicstringmsecondid="1";protectedvoidPage_Load(objectsender,EventArgse){}protectedvoidButton1_Click(objectsender,EventArgse){stringXMLPathFull=@"C:a.xml";StreamReadersr=newStreamReader(XMLPathFull);MSXML2.XMLHTTPxmlhttp=newMSXML2.XMLHTTPClass();stringurl="http://localhost:13789/";xmlhttp.open("post",url,true,"","");xmlhttp.setRequestHeader("Content-Type","text/xml;charset=UTF-8");xmlhttp.send(sr.ReadToEnd());}}}接收网站页面<%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="Default.aspx.cs"Inherits="WebApplication3._Default"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title>无标题页</title></head><body><formid="form1"runat="server"><div><asp:ButtonID="Button1"runat="server"OnClick="Button1_Click"Text="Button"/></div></form></body></html>usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;namespaceWebApplication3{publicpartialclass_Default:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){}protectedvoidButton1_Click(objectsender,EventArgse){MSXML2.XMLHTTPxmlhttp=newMSXML2.XMLHTTPClass();stringurl="http://localhost:13489/";xmlhttp.open("get",url,true,"","");byte[]buf=Request.BinaryRead(Request.ContentLength);stringstr=System.Text.Encoding.UTF8.GetString(buf);Response.Write(str);}}}
解决方案
解决方案二:
debug下,兄弟!