With SSH.NET, I am trying to trigger a file to be downloaded by the browser instead of directly writing it to the local file storage.
using(var saveFile = File.OpenWrite(@"Downloads")) {
result = client.BeginDownloadFile(remotePath + fileName, saveFile) as SftpUploadAsyncResult;
client.EndUploadFile(result);
}
The above code fails as my the application pool identity doesn't have permission to write files and I cannot give permission as I don't have Admin privileges to my computer.
So better option would be to trigger the download through browser which was working earlier with FtpWebRequest.
But my current task is to convert the FTP download to SFTP download.
Can someone suggest the best way to trigger browser download?