Как открыть PDF-файл в новой вкладке или окне вместо загрузки это (с использованием asp.net)?
Мой HTTP-ответ
Код: Выделить всё
HTTP/1.1 200 OK
Cache-Control: private, s-maxage=0
Content-Type: application/octet-stream
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 5.2
content-disposition: inline;filename=FileName.pdf
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Content-Length: 141954
Код: Выделить всё
public async Task Index(string fileName)
{
byte[] document = await getFileContent("SomePathForTheFile");
HttpContext.Response.AddHeader("content-disposition", "inline;filename=" + document.FileName);
return File(document, "application/octet-stream");
}
Подробнее здесь: https://stackoverflow.com/questions/402 ... ownloading