标签:data get proc ble response sel c# style javascrip
原文发布时间为:2009-09-30 —— 来源于本人的百度文章 [由搬家工具导入]
Handler.ashx文件:
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using System.Data;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
string strSql = "Select IP from Web where _D="+context.Request.QueryString["id"];
DataUtility objData = new DataUtility();
DataSet dstList = objData.QueryData(strSql);
context.Response.ContentType = "text/plain";
context.Response.Write("document.write(\"" + dstList.Tables[0].Rows[0][0].ToString() + "\")");
}
public bool IsReusable {
get {
return false;
}
}
html或者 aspx文件:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<script type="text/javascript" src="/ajax/AjaxHandler"></script>
<title>无标题页</title>
</head>
<body>
<script type="text/javascript" src="Handler.ashx?id=2"></script>
</body>
</html>
输出结果为 ID为2的 IP
标签:data get proc ble response sel c# style javascrip
原文地址:http://www.cnblogs.com/handboy/p/7158358.html