I'm working on an assignment, and I'm stuck in downloading section. I can upload the file. But when I'm trying to download the same file after uploading, I get an error ("Access is denied").
Here is the code which I have written:
[HttpGet]
public FileResult Download (string fileName)
{
var permissionSet = new PermissionSet(PermissionState.None);
var writePermission = new FileIOPermission(FileIOPermissionAccess.Write, @"D:\Assignment\Ment\Ment\Photos");
permissionSet.AddPermission(writePermission);
var FileVirtualPath = Server.MapPath("~/Photos/" + fileName); //"~/Photos/" + fileName;
return new FilePathResult(@"D:\Assignment\Ment\Ment\Photos", "application/octet-stream");
}