如何在ASP.NET C#中访问public_ftp和服务器文件?

我将图像存储在public_ftp中。现在如何访问public_ftp文件。我有链接,也有usernamepassword。但是如何在public_ftp中使用server mappath链接。

   string[] filePaths = Directory.GetFiles(Server.MapPath("~\\screenshots\\" +eventID));
            IEnumerable<string> filess = Enumerable.Empty<string>();
            // Get all the files in the sourceDir
            foreach (string name in myList)
            {

                string fname = name;
                path = Server.MapPath("~\\screenshots\\" +eventID+"\\" + fname);
                if (System.IO.File.Exists(path))
                {
                    var attachment = new system.web.Mail.MailAttachment(path);
                    myMail.Attachments.Add(attachment);
                }

            }

我如何使用Server.MapPath('FTP LINK')中的ftp链接,如果有人将文件存储在服务器上并且他提供了我的凭据并且我想访问图像并在应用程序中使用,我还应该如何访问服务器文件。由于隐私原因,我不想将图像存储在托管服务器中。

Asongze123456789 回答:如何在ASP.NET C#中访问public_ftp和服务器文件?

您不能使用Server.MapPath访问FTP,需要使用特定的库才能使用FTP。 .NET有一个类,FTPWebRequest

http://www.vcskicks.com/download-file-ftp.php

本文链接:https://www.f2er.com/3165316.html

大家都在问