{
FullFileName = Server.MapPath(FileName); //FileName--要下载的文件名
FileInfo DownloadFile= new FileInfo(FullFileName);
if(DownloadFile.Exists)
{
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
Response.ContentType="application/octet-stream";
Response.AppendHeader("Content-Disposition","p_w_upload;filename="
+HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.ASCII));
Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
}
else{
//文件不存在
}
}
catch{
//文件不存在
}