This question have been asked like million times, but I have tried those solutions and still can't find out why this error is coming up:
Access to the path 'server1Folder1Folder2Folder3file1.dwg' is denied.
Here is the action which returns the error:
public ActionResult Download(string fileName)
{
fileName = fileName + ".dwg";
string path = Path.Combine(@"\server1Folder1Folder2Folder3", fileName);
return File(path, "application/octet-stream", fileName);
}
I have tried to giving permissions to "Folder3" for multiple usernames, for example "SERVER1NETWORK SERVICE" - Full Control.
Application is running under Default Web Site. Application is running under DefaultAppPool and DefaultAppPool has identity of "NetworkService".
Following code gives identity "NETWORK SERVICE".
WindowsIdentity identity = HttpContext.Request.LogonUserIdentity;
The application was working fine (same download directory) on my own computer, but after deploying this problem showed up.
Server is running Windows 2008 R2 SP1 and IIS 7.5.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…