a guest Jan 23rd, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// <param name="fullFilePath">Path to file on disc</param>
  2. /// <param name="fileName">Name of file. This will be displayed in browser's save dialog</param>
  3. public FilePathResult DownloadFile(string fullFilePath)
  4. {
  5.     var fileName = new FileInfo(fullFilePath).Name;
  6.     var contentType = System.Web.MimeMapping.GetMimeMapping(fullFilePath);
  7.     return new FilePathResult(fullFilePath, contentType)
  8.     {
  9.         FileDownloadName = fileName
  10.     };
  11. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand