问题目详细是这样的.
是想怎么才可以将远程返回的XML文件可以后台用XmlTextReader读取操作这样我的方便了,而不想用js脚本处理.
<%@ Page language= "c# " Codebehind= "WebForm1.aspx.cs " AutoEventWireup= "false " Inherits= "XMLRet.WebForm1 " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >
<HTML>
<HEAD>
<title> WebForm1 </title>
<meta name= "GENERATOR " Content= "Microsoft Visual Studio .NET 7.1 ">
<meta name= "CODE_LANGUAGE " Content= "C# ">
<meta name= "vs_defaultClientScript " content= "JavaScript ">
<meta name= "vs_targetSchema " content= "http://schemas.microsoft.com/intellisense/ie5 ">
<script language= "javascript ">
//请求的js代码:
var xmlhttp;
function createXmlHttpRequest()
{
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlhttp = new ActiveXObject( "Microsoft.XMLHTTP ");
}
xmlhttp.onreadystatechange = handlerun;
xmlhttp.open( "GET ", "WebForm2.aspx ", true);
xmlhttp.send(null);
}
function handlerun()
{
if(xmlhttp.readyState==4 )
if ( xmlhttp.Status==200)
{
var varxml=xmlhttp.responseXML;
var HostIP =varxml.getElementsByTagName( "HostIP ");
alert( " IP_ADDRESS: " + HostIP[0].childNodes[0].nodeValue );
}
}
</script>
</HEAD>
<body>
<form id= "Form1 " method= "post " runat= "server ">
<FONT face= "宋体 ">
<asp:Button id= "Button1 " runat= "server " Text= "XML操作 " Width= "120px "> </asp:Button>
</form>
<div id= "dname "> <FONT face= "宋体 "> </FONT>
</div>
</body>
</HTML>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (! this.IsPostBack)
Button1.Attributes.Add( "onclick ", "createXmlHttpRequest(); ") ;
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>