public ContentResult DownloadFile(string idBulkCatalog) { var oneBulkCatalog = _bulkLoadCatalogBusiness.GetOne(new Guid(idBulkCatalog)); string returnValue = string.Empty; int? statusCode = (int)HttpStatusCode.OK; foreach (var fileTemp in Request.Form.Files) { var fileName = fileTemp.FileName; int indexSeparator = fileName.LastIndexOf(".", StringComparison.Ordinal); //validar extensión de archivo if (0 < indexSeparator) { if (!CBulkLoad.Extention.Equals(fileName.Substring(indexSeparator + 1).ToUpper())) { returnValue = "Archivo no válido, extensión no válida"; statusCode = (int)HttpStatusCode.NotAcceptable; break; } } else { returnValue = "Archivo no válido, no hay extensión"; statusCode = (int)HttpStatusCode.NotAcceptable; break; } //validacion de contenido if (1 < fileTemp.Length) { byte[] bufferDocument; returnValue = BulkLoadUtil.ValidateContentBulkFile(fileTemp, oneBulkCatalog.Separator , oneBulkCatalog.ColumnNumber, out bufferDocument); if (string.IsNullOrEmpty(returnValue)) { SharedMemory.Set(CBulkLoad.CSessionFile, bufferDocument); returnValue = "Archivo válido"; statusCode = (int)HttpStatusCode.OK; break; } statusCode = (int)HttpStatusCode.NotAcceptable; break; } returnValue = "Error, Archivo Vacio"; statusCode = (int)HttpStatusCode.NotAcceptable; } var response = new ContentResult { Content = returnValue, StatusCode = statusCode }; return(response); }