string str = "<?xml version=/"1.0/" encoding=/"gb2312/"?><a><b>sdffdsfdsfd1234</b></a>";
byte[] by = System.Text.Encoding.Default.GetBytes(str);
this.Response.OutputStream.Write(by,0,Convert.ToInt32(by.Length));
Response.Charset = "gb2312";
Response.AppendHeader("Content-Disposition","attachment;filename=1.xml");
Response.ContentType = "text/xml";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter (tw);
Response.Write(tw.ToString());
tw.Close();
hw.Close();
Response.End();
http://community.csdn.net/Expert/TopicView.asp?id=3802270
byte[] by = System.Text.Encoding.Default.GetBytes(str);
this.Response.OutputStream.Write(by,0,Convert.ToInt32(by.Length));
Response.Charset = "gb2312";
Response.AppendHeader("Content-Disposition","attachment;filename=1.xml");
Response.ContentType = "text/xml";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter (tw);
Response.Write(tw.ToString());
tw.Close();
hw.Close();
Response.End();
http://community.csdn.net/Expert/TopicView.asp?id=3802270