asp.net mvc crazy error

Posted by bongoo on Stack Overflow See other posts from Stack Overflow or by bongoo
Published on 2010-05-20T16:56:35Z Indexed on 2010/05/20 17:00 UTC
Read the original article Hit count: 280

Filed under:
|

Hi there im having a weird error which is related to an earlier post , I am checking if a file exists before downloading. This works for pdf's but not for any other type of document

here is my controller action and the typical path for a pdf and a powerpoint file , the powerpoint does not work

~/Documents//FID//TestDoc//27a835a5-bf70-4599-8606-6af64b33945d/FIDClasses.pdf

~/Documents//FID//pptest//ce36e7a0-14de-41f3-8eb7-0d543c7146fe/PPttest.ppt

[UnitOfWork] public ActionResult Download(int id) { Document doc = _documentRepository.GetById(id);

        if (doc != null)
        {




            if (System.IO.File.Exists(Server.MapPath(doc.filepath)))
            {

                _downloadService.AddDownloadsForDocument(doc.document_id, _UserService.CurrentUser().user_id);
                return File(doc.filepath, doc.mimetype, doc.title);
           }

        }
        return RedirectToAction("Index");
    }

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc