Reputation: 815
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>
}
}
}
Upvotes: 2
Views: 4468
Reputation: 16651
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.txt
should be /files/myfile.txt
. You can use Server.MapPath
to obtain the relative path of a file under your web application root.
Upvotes: 2