日期:2014-05-18  浏览次数:20503 次

下载文本文件时,怎么该页的HTML源代码也包括到文本文件后面了?
源代码如下:          
      Response.Clear();
                Response.ContentEncoding   =   System.Text.Encoding.GetEncoding( "utf-8 ");
                Response.ContentType   =   "application/octet-stream ";
                Response.AddHeader( "Content-Disposition ",   "attachment;   filename= "   +   System.Web.HttpUtility.UrlEncode(filename,   System.Text.Encoding.UTF8));
                Response.Flush();
                Response.WriteFile(filepath);

------解决方案--------------------
………
Response.WriteFile(filepath);
//最后加上一句
Response.End();