这个函数,我测试了几个可以的,但是用10M以上的就不能下载
不知道为什么?请高手指点一二,小弟不胜感激!
代码如下:
private void FileDownload(string   FullFileName)
{
FileInfo DownloadFile = new FileInfo(FullFileName); 
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
int n=FullFileName.LastIndexOf(".");
string filecase=FullFileName.Substring(n).Trim();
string contenttype;
switch(filecase)
{
case ".asf":
contenttype = "video/x-ms-asf";break;
case ".avi":
contenttype = "video/avi";break;
case ".doc":
contenttype = "application/msword";break;
case ".rar":
contenttype = "application/rar";break;
case ".zip":
contenttype = "application/zip";break;
case ".xls":
contenttype = "application/vnd.ms-excel";break;
case ".gif":
contenttype = "image/gif";break;
case ".jpg":
case ".jpeg":
contenttype = "image/jpeg";break;
case ".wav":
contenttype = "audio/wav";break;
case ".mp3":
contenttype = "audio/mpeg3";break;
case ".mpg":
case ".mpeg":
contenttype = "video/mpeg";break;
case ".rtf":
contenttype = "application/rtf";break;
case ".htm":
case ".html":
contenttype = "text/html";break;
case ".txt":
contenttype = "text/plain";break;
default:
contenttype = "application/octet-stream" ;break;
} Response.ContentType=contenttype; Response.AppendHeader("Content-Disposition","attachment;filename=" +HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.ASCII));
Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();

}