日期:2014-05-18 浏览次数:20565 次
string FullFileName = "";
                        try
            {
                string FileName = "acrobat.pdf";
                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", "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();
                }
                else
                {
                    //文件不存在
                }
            }
            catch
            {
                //打开时异常了
            }
------解决方案--------------------
http://ufo-crackerx.blog.163.com/blog/static/113078778201211503317177/