//没有测试过
System.Web.HttpContext curContext = System.Web.HttpContext.Current;
strWriter = null;
System.Web.UI.HtmlTextWriter htmlWriter = null;
curContext.Response.ContentType = "application/vnd.ms-xml";
curContext.Response.Charset = "UTF-8";
curContext.Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
curContext.Response.AddHeader("content-disposition", "attachment;filename=download.xml");//设置默认文件名
curContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
strWriter = new ();
htmlWriter = new System.Web.UI.HtmlTextWriter(strWriter);
htmlWriter.WriteLine("写入xml内容");
curContext.Response.Write(strWriter.ToString());//输出到浏览器
curContext.Response.End();