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

使用 FtpWebRequest 重命名文件

Renaming file with FtpWebRequest(使用 FtpWebRequest 重命名文件)
本文介紹了使用 FtpWebRequest 重命名文件的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

將文件移動(dòng)到另一個(gè) FTP 位置時(shí),您必須將 RenameTo 與新的 FTP 位置一起使用.

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

在本例中,如何使用 RenameTo 移動(dòng)到新的 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 屬性設(shè)置目標(biāo)路徑,而不是 URL:

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

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

根據(jù) FtpWebRequest 的 MSDN 文檔.RenameTo 屬性:

As per MSDN documentation for FtpWebRequest.RenameTo property:

獲取或設(shè)置要重命名的文件的新名稱.

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

比較 WebRequest.Create 方法:

Compare to WebRequest.Create method:

為指定的 URI 方案初始化一個(gè)新的 WebRequest 實(shí)例.

Initializes a new WebRequest instance for the specified URI scheme.


RenameTo 中的 URL 將是多余的,因?yàn)槟荒苁褂盟鼇?lái)重命名".文件到另一臺(tái)服務(wù)器.


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

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

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

相關(guān)文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進(jìn)行身份驗(yàn)證并跨請(qǐng)求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權(quán)不起作用)
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(如何獲取守護(hù)進(jìn)程或服務(wù)器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問(wèn)令牌和刷新令牌) - IT屋-程序員軟件開(kāi)發(fā)技
.Net Core 2.0 - Get AAD access token to use with Microsoft Graph(.Net Core 2.0 - 獲取 AAD 訪問(wèn)令牌以與 Microsoft Graph 一起使用)
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調(diào)用時(shí) Azure KeyVault Active Directory AcquireTokenAsync 超時(shí))
主站蜘蛛池模板: 黄视频网址| 国产精品视频中文字幕 | 午夜免费看视频 | 国产最新精品视频 | 国产一二三区精品视频 | 人人爽人人爽人人片av | 网络毛片 | 日日操夜夜摸 | 一区二区av | 欧美日韩一区二区视频在线观看 | 午夜精品久久久久久久99黑人 | www.中文字幕.com | 精品在线一区二区三区 | 中文字幕一区二区三区在线观看 | 天天插天天狠天天透 | 欧美日韩成人在线 | www.国产视频 | 精品久久久久久久久久 | 亚洲午夜av久久乱码 | 欧美一区2区三区3区公司 | 亚洲视频免费在线 | 国产精品免费大片 | 人人九九精 | 久久久精品高清 | 免费99视频 | 日韩一区二区三区在线观看 | 97国产爽爽爽久久久 | 欧美精品一区二区三区蜜臀 | 天天综合网91 | 国产乱码精品一品二品 | 久久中文字幕一区 | 嫩草视频网 | www.精品国产 | 日日夜夜精品免费视频 | av手机在线播放 | 一区二区三区高清不卡 | 国产精品久久久久久久久久免费看 | 亚洲高清视频一区二区 | 国产成人亚洲精品 | 日韩最新网站 | 成人免费视频网站在线看 |