怎么下载xml文件呢 C# vs2005  谢谢!~

private void FileDownload(string FullFileName)  //下载xml文件
{
    FileInfo DownloadFile = new FileInfo(FullFileName);
    this.Response.Clear();
    this.Response.ClearHeaders();
    this.Response.Buffer = false;
    this.Response.ContentType ="application/octet-stream";
    this.Response.AppendHeader("Content-Disposition","attachment;filename="+HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));
    this.Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
    this.Response.WriteFile(DownloadFile.FullName);
    this.Response.Flush();
    this.Response.End();
}

 

给一个完整的 绝对路径 就OK!!

 

------------------------广告之家 http://www.adggs.com

原文地址:https://www.cnblogs.com/binlunia/p/11267783.html