来自MSDN的解释:XmlHttp提供客户端同http服务器通讯的协议。客户端可以通过XmlHttp对象(MSXML2.XMLHTTP.3.0)向http服务器发送请求并使用微软XML文档对象模型Microsoft® XML Document Object Model (DOM)处理回应。 现在的绝对多数浏览器都增加了对XmlHttp的支持,IE中使用ActiveXObject方式创建XmlHttp对象,其他浏览器如:Firefox、Opera等通过window.XMLHttpRequest来创建xmlhttp对象。
<%@ WebHandler Language="C#" Class="Handler"%> using System; using System.Web; using System.Data; using System.Data.SqlClient; publicclass Handler : IHttpHandler { publicvoid ProcessRequest (HttpContext context) { context.Response.ContentType ="text/plain"; int a = Convert.ToInt32(context.Request.QueryString["num1"]); int b = Convert.ToInt32(context.Request.QueryString["num2"]); int result = a + b; context.Response.Write(result); } publicbool IsReusable { get { returnfalse; } } }