public Task<ActionResult> CreateDownloadFileActionResultAsync(Uri requestUrl, string folderName, string fileName)
        {
            if (String.IsNullOrWhiteSpace(folderName))
            {
                throw new ArgumentNullException(nameof(folderName));
            }

            if (String.IsNullOrWhiteSpace(fileName))
            {
                throw new ArgumentNullException(nameof(fileName));
            }

            var path = BuildPath(_configuration.FileStorageDirectory, folderName, fileName);
            if (!_fileSystemService.FileExists(path))
            {
                return Task.FromResult<ActionResult>(new HttpNotFoundResult());
            }

            var result = new FilePathResult(path, GetContentType(folderName))
            {
                FileDownloadName = new FileInfo(fileName).Name
            };

            return Task.FromResult<ActionResult>(result);
        }
Пример #2
0
 public FileResult Template(string path)
 {
     var phyPath = new FileHelper().GetPhysicalPath(path);
     const string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
     var rslt = new FilePathResult(phyPath, contentType) {FileDownloadName = "template.xlsx"};
     return rslt;
 }
        public void ConstructorSetsFileNameProperty() {
            // Act
            FilePathResult result = new FilePathResult("someFile", "contentType");

            // Assert
            Assert.AreEqual("someFile", result.FileName);
        }
Пример #4
0
        /// <summary>
        /// 导出文件
        /// </summary>
        /// <param name="filePath">要导出的文件的绝对路径</param>
        /// <param name="outputName">要输出的文件名称, 含扩展名; 若没有输入,则为指定的文件的文件名</param>
        public void OutPut(string filePath, string outputName = null)
        {
            var fileName = outputName ?? Path.GetFileName(filePath);
            var fileResult = new FilePathResult(filePath, MimeMapping.GetMimeMapping(fileName))
            {
                FileDownloadName = fileName
            };

            fileResult.ExecuteResult(this.context);
        }
        public ActionResult CreateDownloadFileActionResult(
            string folderName,
            string fileName)
        {
            if (String.IsNullOrWhiteSpace(folderName)) throw new ArgumentNullException("folderName");
            if (String.IsNullOrWhiteSpace(fileName)) throw new ArgumentNullException("fileName");

            var path = BuildPath(configuration.FileStorageDirectory, folderName, fileName);
            if (!fileSystemSvc.FileExists(path)) return new HttpNotFoundResult();

            var result = new FilePathResult(path, GetContentType(folderName));
            result.FileDownloadName = new FileInfo(fileName).Name;
            return result;
        }
 public ActionResult Download(string p)
 {
     if (!Services.Authorizer.Authorize(Permissions.DownloadPackages, T("Not allowed to download packages")))
         return new HttpUnauthorizedResult();
     
     string fileName = _packageService.CreatePackage(p, _tempPackageStoragePath.Value);
     if (!string.IsNullOrWhiteSpace(fileName) && System.IO.File.Exists(fileName))
     {
         var filePathResult = new FilePathResult(fileName, _mimeTypeProvider.GetMimeType(fileName));
         filePathResult.FileDownloadName = Path.GetFileName(fileName);
         return filePathResult;
     }
     return new HttpNotFoundResult();
 }
Пример #7
0
 public ActionResult Index()
 {
     var r = new FilePathResult("~/index.html", "text/html");
     return r;
 }
Пример #8
0
        public ActionResult DescargarArchivos(int GrupoId)
        {
            if (!PermitirAcceso())
                return RedirigirFaltaAcceso();

            var Grupo = ePortafolioRepositoryFactory.GetGruposRepository().GetOne(GrupoId);
            var AlumnosGrupoId = ePortafolioRepositoryFactory.GetAlumnosGrupoRepository().GetWhere(x => x.GrupoId == GrupoId).Select(x => x.AlumnoId);
            var Alumnos = SSIARepositoryFactory.GetAlumnosRepository().GetWhere(x => AlumnosGrupoId.Contains(x.AlumnoId), x => x.Nombre);
            var Archivos = ePortafolioRepositoryFactory.GetArchivosRepository().GetArchivosGrupo(GrupoId);

            String zipFilename = Path.GetTempPath() + Guid.NewGuid() + ".zip";
            String integrantesFilename = Path.GetTempPath() + Guid.NewGuid() + ".txt";

            StreamWriter streamWriter = System.IO.File.CreateText(integrantesFilename);

            var NombreAlumnos = "";

            foreach (var Alumno in Alumnos)
            {
                NombreAlumnos += ", " + Alumno.AlumnoId;

                if (Alumno.AlumnoId == Grupo.LiderId)
                    streamWriter.WriteLine(String.Format("{0}\t{1} ({2}) ^ Lider", Alumno.AlumnoId, Alumno.Nombre, Alumno.NombreCarrera));
                else
                    streamWriter.WriteLine(String.Format("{0}\t{1} ({2})", Alumno.AlumnoId, Alumno.Nombre, Alumno.NombreCarrera));
            }

            if (NombreAlumnos.Length > 0)
                NombreAlumnos = NombreAlumnos.Remove(0, 2);
            else
                NombreAlumnos = "Archivos";

            streamWriter.Flush();
            streamWriter.Close();

            ZipFile z = ZipFile.Create(zipFilename);
            z.BeginUpdate();

            var id = 0;
            Archivos = Archivos.OrderBy(x => x.Nombre).ToList();
            foreach (var Archivo in Archivos)
            {
                var FilePath = Server.MapPath("~") + Archivo.Ruta;
                if (System.IO.File.Exists(FilePath))
                    z.Add(FilePath, (++id).ToString("D3") + " " + Archivo.Nombre);
            }
            z.Add(integrantesFilename, "Integrantes.txt");
            z.CommitUpdate();
            z.Close();

            var FilePathResult = new FilePathResult(zipFilename, ".zip");
            FilePathResult.FileDownloadName = MakeValidFileName(Guid.NewGuid().ToString().Replace("-", "").ToUpper().Substring(0, 6) + " - Trabajo " + Grupo.ExtraTrabajo.Codigo + " " + NombreAlumnos) + ".zip";

            return FilePathResult;
        }
Пример #9
0
 public ActionResult ContactSubmited()
 {
     var result = new FilePathResult("~/Views/Home/Index.html", "text/html");
     return result;
 }
Пример #10
0
        public ActionResult DownloadFiles(int GrupoId)
        {
            BEGrupo Grupo = RepositoryFactory.GetGrupoRepository().GetGrupo(GrupoId);
            List<BEAlumno> Alumnos = RepositoryFactory.GetAlumnoRepository().GetAlumnosGrupo(GrupoId);
            List<BEArchivo> Archivos = RepositoryFactory.GetArchivoRepository().GetArchivosGrupo(GrupoId);

            String zipFilename = Path.GetTempPath() + Guid.NewGuid() + ".zip";
            String integrantesFilename = Path.GetTempPath() + Guid.NewGuid() + ".txt";

            StreamWriter streamWriter = System.IO.File.CreateText(integrantesFilename);

            foreach (BEAlumno Alumno in Alumnos)
            {
                if (Alumno.AlumnoId == Grupo.Lider.AlumnoId)
                    streamWriter.WriteLine(Alumno.Nombre + " (LIDER)");
                else
                    streamWriter.WriteLine(Alumno.Nombre);
            }

            streamWriter.Flush();
            streamWriter.Close();

            ZipFile z = ZipFile.Create(zipFilename);
            z.BeginUpdate();
            foreach (BEArchivo Archivo in Archivos)
            {
                z.Add(Server.MapPath("~") + Archivo.Ruta, Archivo.Nombre);
            }
            z.Add(integrantesFilename, "Integrantes.txt");
            z.CommitUpdate();
            z.Close();

            var FilePathResult = new FilePathResult(zipFilename, ".zip");
            FilePathResult.FileDownloadName = "archivos_grupo.zip";
            return FilePathResult;
        }
Пример #11
0
        public ActionResult DescargarArchivo(int GrupoId, int ArchivoId)
        {
            if (!PermitirAcceso())
                return RedirigirFaltaAcceso();

            var ActualAlumnoId = Session.Get(GlobalKey.UsuarioId).ToString();
            var ArchivosGrupo = ePortafolioRepositoryFactory.GetArchivosGrupoRepository().GetOne(ArchivoId, GrupoId);
            var AlumnoGrupo = ePortafolioRepositoryFactory.GetAlumnosGrupoRepository().GetOne(ActualAlumnoId, GrupoId);

            if (AlumnoGrupo == null)
                PostMessage("No tiene los permisos necesarios para eliminar el grupo.", MessageType.Error);
            else if (ArchivosGrupo == null || !System.IO.File.Exists(Server.MapPath("~") + ArchivosGrupo.ExtraArchivo.Ruta))
                PostMessage("No se encuentra el archivo", MessageType.Error);
            else
            {
                var FilePathResult = new FilePathResult(Server.MapPath("~") + ArchivosGrupo.ExtraArchivo.Ruta, "application/octet-stream");
                FilePathResult.FileDownloadName = ArchivosGrupo.ExtraArchivo.Nombre;
                return FilePathResult;
            }

            return Redirect(Request.UrlReferrer.ToString());
        }
Пример #12
0
 /// <summary>
 /// Creates a FilePathResult object by using the file name, the content type, and the file download name.
 /// </summary>
 /// 
 /// <returns>
 /// The file-stream result object.
 /// </returns>
 /// <param name="fileName">The path of the file to send to the response.</param><param name="contentType">The content type (MIME type).</param><param name="fileDownloadName">The file name to use in the file-download dialog box that is displayed in the browser.</param>
 protected internal virtual FilePathResult File(string fileName, string contentType, string fileDownloadName)
 {
     var filePathResult = new FilePathResult(fileName, contentType)
     {
         FileDownloadName = fileDownloadName
     };
     return filePathResult;
 }
        public FileResult GetOperationsLog()
        {
            if (!System.IO.File.Exists(UserLogging.LogFileName))
            {
                FileStream fs = System.IO.File.Create(UserLogging.LogFileName);
                fs.Dispose();

            }
            Response.Write('\uFEFF');
            FilePathResult fpr = new FilePathResult(UserLogging.LogFileName, "text/csv");
            fpr.FileDownloadName = UserLogging.LogDownloadName;
            Response.ContentEncoding = Encoding.UTF8;
            return fpr;
        }
Пример #14
0
        public ActionResult Download(string id, string email, int? orderItemId)
        {
            StoreFrontConfiguration config = CurrentStoreFrontConfigOrThrow;

            IGstoreDb db = GStoreDb;
            if (string.IsNullOrEmpty(id) || id == "0")
            {
                db.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Orders, UserActionActionEnum.Orders_DigitalDownload_Failure, "Bad Url. OrderId missing", false, orderNumber: id, orderItemId: orderItemId);
                return HttpBadRequest("Order ID cannot be null or zero");
            }

            if (!orderItemId.HasValue || orderItemId == 0)
            {
                db.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Orders, UserActionActionEnum.Orders_DigitalDownload_Failure, "Bad Url. Order Item Id missing", false, orderNumber: id, orderItemId: orderItemId);
                return HttpBadRequest("Order Item ID cannot be null or zero");
            }

            Order order = config.StoreFront.Orders.Where(o => o.OrderNumber == id && o.Email.ToLower() == email.ToLower()).SingleOrDefault();
            if (order == null)
            {
                db.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Orders, UserActionActionEnum.Orders_DigitalDownload_Failure, "Order not found by Id and email. Order Id: " + id + " Email: " + email, false, orderNumber: id, orderItemId: orderItemId.Value);
                return HttpNotFound("Order not found. Order Id: " + id + " Email: " + email);
            }

            OrderItem orderItem = order.OrderItems.Where(oi => oi.OrderItemId == orderItemId.Value).SingleOrDefault();
            if (orderItem == null)
            {
                db.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Orders, UserActionActionEnum.Orders_DigitalDownload_Failure, "Order Item not found by id. Order Id: " + id + " Email: " + email + " Order Item Id: " + orderItemId.Value, false, orderNumber: id, orderItemId: orderItemId.Value);
                return HttpNotFound("Order Item not found by id. Order Id: " + id + " Email: " + email + " Order Item Id: " + orderItemId.Value);
            }

            Product product = orderItem.Product;
            if (!product.DigitalDownload)
            {
                //no longer digital download
                db.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Orders, UserActionActionEnum.Orders_DigitalDownload_Failure, "Product '" + product.UrlName + "' [" + product.ProductId + "] is not set for Digital Download. Order Id: " + id + " Email: " + email + " Order Item Id: " + orderItemId.Value, false, orderNumber: id, orderItemId: orderItemId.Value);
                return HttpNotFound("Product '" + product.UrlName + "' [" + product.ProductId + "] is not set for Digital Download. Order Id: " + id + " Email: " + email + " Order Item Id: " + orderItemId.Value);
            }

            if (string.IsNullOrEmpty(product.DigitalDownloadFileName))
            {
                //no file name
                string errorMessage = "There is no file set for digital download for Product '" + product.Name.ToHtmlLines() + "' [" + product.ProductId + "]";
                db.CreateDigitalDownloadErrorNotificationToOrderAdminAndSave(config, CurrentUserProfileOrNull, orderItem, Url, errorMessage);

                db.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Orders, UserActionActionEnum.Orders_DigitalDownload_Failure, "Product '" + product.UrlName + "' [" + product.ProductId + "] has no file set for Digital Download. Order Id: " + id + " Email: " + email + " Order Item Id: " + orderItemId.Value, false, orderNumber: id, orderItemId: orderItemId.Value);
                return HttpNotFound("Product '" + product.UrlName + "' [" + product.ProductId + "] has no file set for Digital Download. Order Id: " + id + " Email: " + email + " Order Item Id: " + orderItemId.Value);
            }

            string filePath = product.DigitalDownloadFilePath(Request.ApplicationPath, RouteData, Server);
            if (string.IsNullOrEmpty(filePath))
            {
                string errorMessage = "File Not Found '" + filePath.ToHtmlLines()  + "' for digital download for Product '" + product.Name + "' [" + product.ProductId + "]";
                db.CreateDigitalDownloadErrorNotificationToOrderAdminAndSave(config, CurrentUserProfileOrNull, orderItem, Url, errorMessage);

                //file not found
                db.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Orders, UserActionActionEnum.Orders_DigitalDownload_Failure, "Product '" + product.UrlName + "' [" + product.ProductId + "] digital download file '" + product.DigitalDownloadFileName + "' is not found. Order Id: " + id + " Email: " + email + " Order Item Id: " + orderItemId.Value, false, orderNumber: id, orderItemId: orderItemId.Value);
                return HttpNotFound("Product '" + product.UrlName + "' [" + product.ProductId + "] digital download file '" + product.DigitalDownloadFileName + "' is not found. Order Id: " + id + " Email: " + email + " Order Item Id: " + orderItemId.Value);
            }

            string mimeType = MimeMapping.GetMimeMapping(filePath);
            FilePathResult result = new FilePathResult(filePath, mimeType);
            result.FileDownloadName = product.DigitalDownloadFileName;

            db.LogUserActionEvent(HttpContext, RouteData, this, UserActionCategoryEnum.Orders, UserActionActionEnum.Orders_DigitalDownload_Success, id, true, orderNumber: id, orderItemId: orderItemId.Value);

            //update order item status and order status
            if (!orderItem.StatusItemDownloaded)
            {
                orderItem.StatusItemDownloaded = true;
                if (order.OrderItems.Any(oi => !oi.StatusItemDownloaded))
                {
                    order.StatusOrderDownloaded = false;
                }
                else
                {
                    //all items are downloaded
                    order.StatusOrderDownloaded = true;
                }
                db.SaveChanges();
            }

            return result;
        }
Пример #15
0
        public override void When()
        {
            base.When();

            TheReportRequestController = ReportViewerSpecifications
                .InitializeReportRequestHandler(TheReportService);

            TheFile = TheReportRequestController.Get(TheReportId) as FilePathResult;
        }
Пример #16
0
 // GET: UtilitiesExcelTemplate
 public ActionResult DownloadTemplate()
 {
     // Download the Excel spreadsheet...
     var fpr = new FilePathResult(ExcelTemplate,
         "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
     var fName = System.IO.Path.GetFileName(ExcelTemplate);
     fpr.FileDownloadName = fName;
     return fpr;
 }
Пример #17
0
        // GET: Attachments/Dowload/5
        public ActionResult Download(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            TicketAttachment ticketAttachment = db.TicketAttachments.Find(id);
            if (ticketAttachment == null)
            {
                return HttpNotFound();
            }

            // Now, download this item!
            // Get the full path first...
            var fpr = new FilePathResult(ticketAttachment.FilePath, ticketAttachment.ContentType);
            //Response.ContentType = ticketAttachment.ContentType;
            //Response.AddHeader("Content-Disposition", "inline");
            var fName = Path.GetFileName(ticketAttachment.FilePath);
            fpr.FileDownloadName = fName;
            return fpr;

            //// Do this in every GET action...
            //ViewBag.UserModel = ProjectsHelper.LoadUserModel();
            //return RedirectToAction("Index", new { Id = ticketAttachment.TicketId });
        }
        private ActionResult DownloadFile(string id, string folder, string path, bool asDownload = true)
        {
            string contentRoot = this.Content.GetContentRoot(id);
            string htmlRoot = Path.Combine(contentRoot, folder);

            string realPath = Path.GetFullPath(Path.Combine(htmlRoot, path.TrimStart('/')));
            if (realPath.StartsWith(htmlRoot))
            {
                FilePathResult result = new FilePathResult(realPath, "text/text");

                if (asDownload)
                    result.FileDownloadName = Path.GetFileName(realPath);

                return result;
            }

            throw new HttpException((int)HttpStatusCode.Forbidden, "Forbidden!");
        }
Пример #19
0
        public FilePathResult Download(string name)
        {
            if (name.Contains(".") || name.Contains("/") || name.Contains("\\"))
                return null;

            var exportDir = Server.MapPath("~/Export");
            var zipFile = Path.Combine(exportDir,
                "Template_" + name + "_" + DateTime.Now.ToString("yyyyMMddTHHmmss") + ".zip");

            var viewsDir = Path.Combine(Server.MapPath("~/Views"), name);
            var contentDir = Path.Combine(Server.MapPath("~/Content/Themes"), name);

            using (var zip = new ZipFile(zipFile))
            {
                zip.AddDirectory(viewsDir, "Views");
                zip.AddDirectory(contentDir, "Content");

                zip.Save();
            }

            var result = new FilePathResult(zipFile, "application/zip");
            result.FileDownloadName = "Template_" + name + "_" + DateTime.Now.ToString("yyyyMMddTHHmmss") + ".zip";
            return result;
        }
Пример #20
0
 public FilePathResult Download(string filePath, string testName)
 {
     FilePathResult FPResult = new FilePathResult(filePath, System.Net.Mime.MediaTypeNames.Application.Octet);
     FPResult.FileDownloadName = testName + " " + formatPath(filePath) + ".txt";
     return FPResult;
 }
Пример #21
0
        public FilePathResult DownloadFile(string theme, string name)
        {
            if (theme.Contains(".") || theme.Contains("/") || theme.Contains("\\")
                || name.Contains("..") || name.Contains("/") || name.Contains("\\"))
                return null;

            name = name.Replace('|', '\\');

            var filePath = Path.Combine(Server.MapPath("~/Views"), theme, name);

            var result = new FilePathResult(filePath, "application/octet-stream");
            result.FileDownloadName = Path.GetFileName(filePath);
            return result;
        }
Пример #22
0
        public ActionResult DescargarOutcome(String AlumnoId, int OutcomeId)
        {
            if (!PermitirAcceso())
                return RedirigirFaltaAcceso();

            var TrabajosOutcomeAlumno = ePortafolioRepositoryFactory.GetTrabajosOutcomeAlumnoRepository().GetWhere(x => x.AlumnoId == AlumnoId && x.OutcomeId == OutcomeId);

            String zipFilename = Path.GetTempPath() + Guid.NewGuid() + ".zip";
            ZipFile z = ZipFile.Create(zipFilename);
            z.BeginUpdate();
            StreamWriter streamWriter;

            var Outcome = SSIARepositoryFactory.GetOutcomesRepository().GetOne(OutcomeId);
            var Alumno = SSIARepositoryFactory.GetAlumnosRepository().GetOne(AlumnoId);
            foreach (var trabajo in TrabajosOutcomeAlumno)
            {
                var Grupo = ePortafolioRepositoryFactory.GetGruposRepository().GetGrupoTrabajo(trabajo.TrabajoId,AlumnoId);

                if (Grupo == null)
                    continue;

                var Curso = SSIARepositoryFactory.GetCursosRepository().GetOne(Grupo.ExtraTrabajo.CursoId);
                var AlumnosGrupoId = ePortafolioRepositoryFactory.GetAlumnosGrupoRepository().GetWhere(x => x.GrupoId == Grupo.GrupoId).Select(x => x.AlumnoId);
                var Alumnos = SSIARepositoryFactory.GetAlumnosRepository().GetWhere(x => AlumnosGrupoId.Contains(x.AlumnoId), x => x.Nombre);
                var Archivos = ePortafolioRepositoryFactory.GetArchivosRepository().GetArchivosGrupo(Grupo.GrupoId);

                String directoryName = MakeValidFileName(String.Format("{0} {1}-{2} {3}",Grupo.TrabajoId.ToString("D6"), Curso!=null?Curso.Codigo:"INDEP", Grupo.ExtraTrabajo.Codigo??"GEN", Grupo.NombreTrabajo));
                String integrantesFilename = Path.GetTempPath() + Guid.NewGuid() + ".txt";

                streamWriter = System.IO.File.CreateText(integrantesFilename);

                z.AddDirectory(directoryName);

                foreach (var alumno in Alumnos)
                {
                    if (alumno.AlumnoId == Grupo.LiderId)
                        streamWriter.WriteLine(String.Format("{0}\t{1} ({2}) ^ Lider", alumno.AlumnoId, alumno.Nombre, alumno.NombreCarrera));
                    else
                        streamWriter.WriteLine(String.Format("{0}\t{1} ({2})", alumno.AlumnoId, alumno.Nombre, alumno.NombreCarrera));
                }

                streamWriter.Flush();
                streamWriter.Close();

                var id = 0;
                Archivos = Archivos.OrderBy(x => x.Nombre).ToList();
                foreach (var Archivo in Archivos)
                {
                    var FilePath = Server.MapPath("~") + Archivo.Ruta;
                    if (System.IO.File.Exists(FilePath))
                        z.Add(FilePath, directoryName + "\\" + (++id).ToString("D3") +" "+ Archivo.Nombre);
                }
                z.Add(integrantesFilename, directoryName + "\\" + "Integrantes.txt");
            }

            String outcomesFilename = Path.GetTempPath() + Guid.NewGuid() + ".txt";
            streamWriter = System.IO.File.CreateText(outcomesFilename);

            streamWriter.WriteLine(String.Format("Alumno: {0}", Alumno.Nombre));
            streamWriter.WriteLine(String.Format("Carrera: {0}", Alumno.NombreCarrera));
            streamWriter.WriteLine(String.Format("Correo: {0}", Alumno.CorreoElectronico));
            streamWriter.WriteLine("");
            streamWriter.WriteLine(String.Format("Outcome: {0}", Outcome.Outcome));
            streamWriter.WriteLine(String.Format("Descripcion: {0}", Outcome.Descripcion));
            streamWriter.Flush();
            streamWriter.Close();
            z.Add(outcomesFilename, "Informacion del outcome.txt");

            z.CommitUpdate();
            z.Close();

            var FilePathResult = new FilePathResult(zipFilename, ".zip");
            FilePathResult.FileDownloadName = MakeValidFileName(Guid.NewGuid().ToString().Replace("-", "").ToUpper().Substring(0, 6) + " - Outcome " + Outcome.Outcome + " " + Alumno.AlumnoId) + ".zip";

            return FilePathResult;
        }
Пример #23
0
 public ActionResult ContactSubmited()
 {
     var result = new FilePathResult("~/grand-legacy.html", "text/html");
     return result;
 }
Пример #24
0
 public ActionResult Index()
 {
     var result = new FilePathResult("~/grand-legacy.html", "text/html");
     return result;
 }
Пример #25
0
 public ActionResult Index()
 {
     var result = new FilePathResult("~/www/index.html", "text/html");
     return result;
     //return View();
 }
Пример #26
0
 public ActionResult GetHtml()
 {
     string path = Request.FilePath;
     var result = new FilePathResult("~/"+ path + "/index.html", "text/html");
     return result;
 }
Пример #27
-1
        public FilePathResult Download(string filePath, string fileName)
        {
            FilePathResult file;

            var extension = Path.GetExtension(fileName).ToLower();

            switch (extension)
            {
                case ".sql":
                    //file = new FilePathResult(filePath, "text/plain");
                    file = new FilePathResult(filePath, "application/octet-stream");
                    break;
                default:
                    file = new FilePathResult(filePath, "application/octet-stream");
                    break;
            }

            file.FileDownloadName = fileName;

            return file;
        }