我现在是点击,直接下载。    我想再做一个,点击能够在浏览器打开,因为 谷歌浏览器 可以直接打开 PDF文件,可以直接浏览
        public ActionResult GetFile(string id)
        {
            //var dl = DownloadsDal.GetById(id);
            var book = LibraryBLL.GetBook(id);
            if (!(bool)book.CanDownload)
                return Content(ClientScript.AlertAndBack("亲,这样做,不对哦!!!")); //防止用户输入超链接下载            if (book == null)
                return JavaScript(ClientScript.AlertAndBack("对不起,不存在指定的下载项目"));            StringBuilder sb = new StringBuilder("~" + book.VirDir).Replace("\\","/").Append(Constants.BookName).Append(book.Extension);
            string filePath = HttpContext.Server.MapPath(sb.ToString());
            
            if (!System.IO.File.Exists(filePath))
                return Content(ClientScript.AlertAndBack("对不起,要下载的文件不存在,该文件可能已被删除或改名"));            FilePathResult fpr = File(filePath, "application/octet-stream", book.Title);
            LibraryBLL.UpdateDownloadTimes(id);                                         //更新下载次数
            return fpr;
        }

解决方案 »

  1.   


    好啊,原来看过你一个文库的例子  :)
    我现在也弄了一个现在想当鼠标在flexpaper上滚动时,希望flexpaper的高度自动填满浏览器高度,就像百度一样
      

  2.   

    不是很明白你得意思 但是提醒一点 首先你需要自定义一些功能的话 需要修改flexpaper源码来实现
    或者你自己用JS和flexpaper来交互
      

  3.   


    我后边百度了,QQ邮件的预览,相当于把附件内容转换成html,并不是直接用web打开。后台应该有个转换,编码过程。