Вам необходимо указать абсолютный путь к методу File
. Используйте Server.MapPath
, чтобы преобразовать родственника в абсолютный путь:
public ActionResult GetAttachment1(string projectID)
{
string projectPath = Server.MapPath("~/Uploads/Project");
string file = Path.Combine(projectPath, projectID);
// at this stage file will look something like this
// "c:\inetpub\wwwroot\Uploads\Project\foo.pdf". Make sure that
// this is a valid PDF file and pass it to the File method
return File(file, "application/pdf", projectID);
}