public
ActionResult MyInvoices()
{
// Get the file names from the persistent store
var documents =
new
[] {
"Filip_20130712.pdf"
,
"Filip_20130713.pdf"
"Filip_20130714.pdf"
};
return
View(documents);
}
<h2>MyInvoices</h2>
<ul>
@
foreach
(var document
in
Model)
<li><a href=
"/Home/DownloadDocument?document=@document"
>Download @document</a></li>
</ul>
ActionResult DownloadDocument(
string
document)
var documentPath = Server.MapPath(Path.Combine(
"Invoices"
, document));
if
(!System.IO.File.Exists(documentPath))
null
;
File(documentPath,
"application/pdf"
, document);
/Home/DownloadDocument?document=..\..\web.config