大家好,我正在上传用户在此路径中上传的文件
string savefilename = Path.Combine(Server.MapPath("~/Content/UploadedFiles/"),
Path.GetFileName());
我将 URL 保存在数据库中的 Url 列中
~/Content/UploadedFiles/BugTrackerDataBase.xlsx
我正在尝试通过我的网格视图中的链接检索用户上传的文件我的检索方法如下所示
public ActionResult ViewAttachments(string AttachmentName)
{
try
{
AttachmentName = Session["AttachmentUrl"].ToString();
var fs = System.IO.File.OpenRead(Server.MapPath("'" + AttachmentName + "'"));
return File(fs, "application/doc", AttachmentName);
}
catch
{
throw new HttpException(404, "Couldn't find " + AttachmentName);
}
}
我有例外
"Could not find a part of the path 'D:\AnilWork\BugTracker\BugTracker\ViewBug\'UploadedFiles\BugTrackerDataBase.xlsx''."
谁能告诉我我在哪里做错了或者写程序来做这个