Это метод загрузки:
Код: Выделить всё
[Route("DownloadFile")]
public async Task DownloadFile(Guid id)
{
var path = await getDocumentFullPath(id);
var fileName = await getDocumentTitle(id);
if (string.IsNullOrWhiteSpace(fileName))
throw new Exception("Please select a file to download.");
if (!System.IO.File.Exists(path))
throw new FileNotFoundException();
var provider = new FileExtensionContentTypeProvider();
if (!provider.TryGetContentType(path, out var contenttype))
{
contenttype = "application/octet-stream";
}
var bytes = await System.IO.File.ReadAllBytesAsync(path);
return File(bytes, contenttype, fileName);
}
Код: Выделить всё
.cshtml
Код: Выделить всё
Title
Date
Document Code
Extension
Action
@foreach (var item in Model)
{
[url=@Url.Action(]@item.Title[/url]
@item.DocumentDate.ToString("dd-MMM-yyyy")
@item.DocumentCode
@item.Extension
[url=@Url.Action(]@item.Title[/url]


Подробнее здесь: https://stackoverflow.com/questions/774 ... he-browser