public class Test : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.StatusCode = 200;
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
DataSet ds = new DataSet("AccountList");
ds = GetList("Account","AccountId","Loginname,Name",50,1,false, false,"1=1");
context.Response.ContentType = "text/xml";
context.Response.Charset = "GB2312";
context.Response.Clear();
context.Response.Write("<?xml version=\"1.0\" encoding=\"gbk\"?>\n " + ds.GetXml());
/*
StringBuilder sb = new StringBuilder();
sb.Append("<?xml version=\"1.0\" encoding=\"gbk\"?>");
sb.Append("<AccountList>");
sb.Append("<Account><loginname>Loro5</loginname><name>wulu</name></user>");
sb.Append("</Account>");
context.Response.Write(sb.ToString());
*/
context.Response.End();
}
public bool IsReusable {
get {
return false;
}
}
}
您可能感兴趣的文章: