aspx输出xml文件格式数据

代码
Response.ContentType = "text/xml";
            Response.Expires 
= -1;
            Response.Charset 
= "utf-8";
            Response.Clear();
            
string res = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><response><message>hello world</message></response>";
            Response.Write(res);
            Response.End();


1、设置输出类型-Response.ContentType = "text/xml";
2、设置字符集-Response.Charset = "";//编码格式 ex:utf-8或gb2312
3、清空输入内容-Response.Clear();

4、构造XML内容并输出-Response.Write()

posted @ 2010-08-02 17:48  单道  阅读(490)  评论(0)    收藏  举报