I am attempting to create links in my view so the end user can download the files in my model. In internet explorer I can right click and download from the link but I cannot left click (it does not open the file). Firefox gives me a message when I click the file that it does’nt know how to open this address, because the protocol (d) isn’t associated with any program.
Here is how I am creating the link.
@{
foreach (var EpubFile in item.files)
{
if(File.Exists(System.Configuration.ConfigurationManager.AppSettings["UploadFileDirectory"] + EpubFile.FileReference))
{
string link = System.Configuration.ConfigurationManager.AppSettings["UploadFileDirectory"] + EpubFile.FileReference;
<a href="@link">@EpubFile.OriginalFileName</a>
}
}
}
Make sure the link is prefixed with
http://and is a full or partial path in URL form, not in filename form. E.g.,c:\inetpub\wwwroot\foo\files\myfile.txtshould be/files/myfile.txt. You can useServer.MapPathto obtain the relative path of a file under your web application root.