我用c#做了一个页面,可以选择服务器上的文件打开或下载,但是如果文件长一点,就不成功,请问哪位知道是怎么回事?

解决方案 »

  1.   

    我的代码如下,请看一下哪里有问题
    private void FileDownload(string FullFileName)
    {
    FileInfo DownloadFile = new FileInfo(FullFileName); 
    Response.Clear();
    Response.ClearHeaders();
    Response.Buffer=false;
    Response.ContentType="application/octet-stream";
    Response.AppendHeader("Content-Disposition","attachment;filename=" +HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));
    Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
    Response.WriteFile(DownloadFile.FullName);
    Response.Flush();
    Response.End();
    }