添加引用:
是MS XMLV2.6(不是V6.0,原因知道的同志给我答案)
using
System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MSXML2;
public partial class _Default : System.Web.UI.Page
... {
protected void Page_Load(object sender, EventArgs e)
...{
}
protected void Button1_Click(object sender, EventArgs e)
...{
string mSiteName = TextSarcher.Text.Trim();
MSXML2.XMLHTTP xmlhttp = new MSXML2.XMLHTTP();
//string Url = "http://X.X.X.X/getservice.php?sitename=" + mSiteName + "";
xmlhttp.open("GET", Url, false, null, null);
xmlhttp.send("");
MSXML2.XMLDocument dom = new XMLDocument();
Byte[] b = (Byte[])xmlhttp.responseBody;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MSXML2;
public partial class _Default : System.Web.UI.Page
... {
protected void Page_Load(object sender, EventArgs e)
...{
}
protected void Button1_Click(object sender, EventArgs e)
...{
string mSiteName = TextSarcher.Text.Trim();
MSXML2.XMLHTTP xmlhttp = new MSXML2.XMLHTTP();
//string Url = "http://X.X.X.X/getservice.php?sitename=" + mSiteName + "";
xmlhttp.open("GET", Url, false, null, null);
xmlhttp.send("");
MSXML2.XMLDocument dom = new XMLDocument();
Byte[] b = (Byte[])xmlhttp.responseBody;
//string Flag = System.Text.ASCIIEncoding.UTF8.GetString(b, 0, b.Length);
string andy = System.Text.Encoding.GetEncoding("GB2312").GetString(b).Trim();
//Response.Write(Url);
//Response.Write(Flag);
Response.Write(andy);
//Response.End();
}
}
string andy = System.Text.Encoding.GetEncoding("GB2312").GetString(b).Trim();
//Response.Write(Url);
//Response.Write(Flag);
Response.Write(andy);
//Response.End();
}
}