Jquery Ajax解析XML数据(同步及异步调用)简单实例(2)

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;
        }
    }

}

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdyxjw.html