Хорошо, поэтому у меня есть метод действий, который генерирует PDF файл и возвращает его в браузер. Проблема заключается в том, что вместо автоматического открытия PDF IE отображает приглашение на загрузку, даже если он знает, какой файл он есть. Chrome делает то же самое. В обоих браузерах, если я нажму ссылку на файл PDF, который хранится на сервере, он откроется просто отлично и никогда не отобразит приглашение загрузки.
Вот код, который вызывается для возврата PDF:
public FileResult Report(int id)
{
var customer = customersRepository.GetCustomer(id);
if (customer != null)
{
return File(RenderPDF(this.ControllerContext, "~/Views/Forms/Report.aspx", customer), "application/pdf", "Report - Customer # " + id.ToString() + ".pdf");
}
return null;
}
Здесь заголовок ответа с сервера:
HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Thu, 16 Sep 2010 06:14:13 GMT
X-AspNet-Version: 4.0.30319
X-AspNetMvc-Version: 2.0
Content-Disposition: attachment; filename="Report - Customer # 60.pdf"
Cache-Control: private, s-maxage=0
Content-Type: application/pdf
Content-Length: 79244
Connection: Close
Должен ли я добавить что-то особенное в ответ, чтобы браузер автоматически открыл PDF?
Любая помощь очень ценится! Спасибо!