سلام و خسته نباشید ببخشید چطوری میتونیم لینک دانلود مستقیم برای فایل های موجود در هاست دانلود ایجاد کنم
سوالات قبلی رو نگاه کردم به نتیجه نرسیدم این کد ها را قرار دادم اما فایل دانلود نمیشه
var filename = downloadRepository.GetDownloadId(id).UploadFile;
try {
string ftp = "...";
رید.
string ftpFolder = "Learn/";
/* Create an FTP Request */
var ftpRequest = (FtpWebRequest)FtpWebRequest.Create(ftp + ftpFolder+filename );
ftpRequest.Credentials = new NetworkCredential("user", "pass");
/* When in doubt, use these options */
ftpRequest.UseBinary = true;
ftpRequest.UsePassive = true;
ftpRequest.KeepAlive = true;
/* Specify the Type of FTP Request */
ftpRequest.Method = WebRequestMethods.Ftp.DownloadFile;
/* Establish Return Communication with the FTP Server */
var ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
/* Get the FTP Server's Response Stream */
var ftpStream = ftpResponse.GetResponseStream();
// TODO: you might need to extract these settings from the FTP response
const string contentType = "application/zip";
const string fileNameDisplayedToUser = "FileName.zip";
return File(ftpStream, contentType, fileNameDisplayedToUser);
}
catch (Exception ex) {
// _logger.Error(ex);
}
return null;
با تشکر
سلام دوست من وقتتون بخیر
از بریک پوینت استفاده کنید خط به خط برید جلو ببینید به ftp وصل میشه یا اصلا فایل رو از مسیر ftp پیدا میکنه یا نه