我正在尝试从localhost中的计算机下载文件。但我一直在收到错误
System.UnauthorizedAccessException:拒绝访问路径'c:\ users \ zunair \ documents \ visual studio 2012 \ Projects \ WebApplication2 \ WebApplication2 \ Uploads'。
这是我的代码
if (FileExt == ".pdf")
{
Response.ContentType = "Application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=FileName");
Response.TransmitFile(Server.MapPath("~/Uploads" + FileName));
Response.End();
}
我在Response.TransmitFile(Server.MapPath("~/Uploads" + FileName));