久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 FtpWebRequest 重命名文件

Renaming file with FtpWebRequest(使用 FtpWebRequest 重命名文件)
本文介紹了使用 FtpWebRequest 重命名文件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

將文件移動到另一個 FTP 位置時,您必須將 RenameTo 與新的 FTP 位置一起使用.

When moving a file to another FTP location you must use RenameTo with the new FTP location.

在本例中,如何使用 RenameTo 移動到新的 FTP 位置?

In this example how do you use RenameTo to move to the new FTP location?

FtpWebRequest ftpRequest = null;
FtpWebResponse ftpResponse = null;
try
{
    ftpRequest = (FtpWebRequest)WebRequest.Create("ftp://mysite.com/folder1/fileName.ext");
    ftpRequest.Credentials = new NetworkCredential("user", "pass");
    ftpRequest.UseBinary = true;
    ftpRequest.UsePassive = true;
    ftpRequest.KeepAlive = true;
    ftpRequest.Method = WebRequestMethods.Ftp.Rename;
    ftpRequest.RenameTo = "ftp://mysite.com/folder2/fileName.ext";
    ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
    ftpResponse.Close();
    ftpRequest = null;
}
catch (Exception ex) { Label1.Text = (ex.ToString()); }

推薦答案

.RenameTo 屬性設置目標路徑,而不是 URL:

Set a target path to .RenameTo property, not URL:

ftpRequest.RenameTo = "/folder2/fileName.ext";
        

根據 FtpWebRequest 的 MSDN 文檔.RenameTo 屬性:

As per MSDN documentation for FtpWebRequest.RenameTo property:

獲取或設置要重命名的文件的新名稱.

Gets or sets the new name of a file being renamed.

比較 WebRequest.Create 方法:

Compare to WebRequest.Create method:

為指定的 URI 方案初始化一個新的 WebRequest 實例.

Initializes a new WebRequest instance for the specified URI scheme.


RenameTo 中的 URL 將是多余的,因為您不能使用它來重命名".文件到另一臺服務器.


The URL would be redundant in RenameTo, as you cannot use it to "rename" the file to another server.

這篇關于使用 FtpWebRequest 重命名文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進行身份驗證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權不起作用)
ASP Core Azure Active Directory Login use roles(ASP Core Azure Active Directory 登錄使用角色)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護進程或服務器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發技
.Net Core 2.0 - Get AAD access token to use with Microsoft Graph(.Net Core 2.0 - 獲取 AAD 訪問令牌以與 Microsoft Graph 一起使用)
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
主站蜘蛛池模板: 久久久国产精品 | 日韩另类视频 | 国产视频精品视频 | 国产aaaaav久久久一区二区 | 国产精品久久久久久久三级 | 久久国内精品 | 亚洲精品视频在线 | 久久久免费电影 | 亚洲欧美一区二区三区国产精品 | 欧美日一区二区 | 日韩久久久久 | 黄色一级大片在线免费看产 | 国产精品国产馆在线真实露脸 | 日韩欧美一级片 | 美女久久久 | 亚洲欧美日韩精品久久亚洲区 | 国产激情91久久精品导航 | 精品一区在线 | 91香蕉视频在线观看 | 一区二区三区在线观看视频 | 欧美精品一区二区三区在线 | 成人免费视频网站 | 紧缚调教一区二区三区视频 | 久久亚洲精品久久国产一区二区 | 91中文字幕在线 | 一区二区三区国产精品 | 国产片淫级awww | 精品国产精品三级精品av网址 | 毛片网在线观看 | 一区二区三区在线播放 | 日韩在线播放一区 | 久久久久国产精品午夜一区 | 亚洲第一视频 | 韩日一区二区 | 视频二区 | 午夜影院普通用户体验区 | 亚洲一二三区不卡 | 中文字幕不卡一区 | 国产这里只有精品 | 亚洲三级在线观看 | 亚洲 中文 欧美 日韩 在线观看 |