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

上傳到 ftp asp.net

upload to ftp asp.net(上傳到 ftp asp.net)
本文介紹了上傳到 ftp asp.net的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

是否可以使用 ASP.NET 將文件直接上傳到 ftp 帳戶文件夾中?

Is it possible to upload a file directly into an ftp account folder with ASP.NET ?

例如我點擊瀏覽,選擇要上傳的文件,當我點擊上傳"按鈕時,它應該將其直接保存到另一個 Web 服務器上的文件夾中,該服務器位于其他地方,而不是用于上傳的服務器.

E.g. I click on browse, select a file to upload and when I click "upload" button, It should save it directly to the folder on another web server located at somewhere else other then the server that is being used to upload.

推薦答案

    /// <summary>
    /// Example call : if (FtpUpload(FileUploadControl1, "ftp.my.com/somePathDir", @"user", "pass!", "domain"))
    /// </summary>
    /// <param name="file"></param>
    /// <param name="ftpServer"></param>
    /// <param name="username"></param>
    /// <param name="ftpPass"></param>
    /// <returns></returns>
    private bool FtpUpload(FileUpload file, string ftpServer, string username, string ftpPass, string domainName = "")
    {
        // ftp://domainuser:password@ftpserver/url-path
        // If you are a member of a domain, then "ftp://domain-nameusername:password@url-path" may fail because the backslash () is sent in as a literal character and Internet Explorer incorrectly looks for a file instead of parsing a Web address. Changing the backslash () in the domain-nameusername to domainname%5Cusername works correctly.

        try
        {
            string ftpAddres;
            if (domainName != string.Empty)
                ftpAddres = "ftp://" + domainName + @"%5C" + username + ":" + ftpPass + "@" + ftpServer + "/" + file.FileName;
            else
                ftpAddres = "ftp://" + username + ":" + ftpPass + "@" + ftpServer + "/" + file.FileName;

            using (var webClient = new System.Net.WebClient())
            {
                webClient.UploadData(new Uri(ftpAddres), file.FileBytes);
            }

        }
        catch (Exception e)
        {
            throw new Exception(e.Message, e);
        }
        return true;
    }

這篇關于上傳到 ftp asp.net的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 超時)
主站蜘蛛池模板: 亚洲精品久久 | 久草视频观看 | 91精品国产综合久久香蕉922 | 亚洲天堂中文字幕 | 91精品国产综合久久精品图片 | 在线观看中文字幕视频 | 久久久久久久一级 | 精品视频一区二区三区在线观看 | h视频在线免费 | 欧美精品一区二区在线观看 | 91九色网站| 在线一区观看 | 亚洲精品一区二三区不卡 | 国产高清视频 | 影音先锋欧美资源 | 99精品国产一区二区青青牛奶 | 草b视频 | 亚洲一区免费在线 | 国产a视频| 欧美日韩视频 | 亚洲精品女人久久久 | 99精品久久 | 成人精品视频99在线观看免费 | 国产在线一区二区 | 国产美女久久久 | 一区二区三区四区五区在线视频 | 日韩高清成人 | 日日av| 国产传媒在线观看 | 亚州精品成人 | 亚洲综合无码一区二区 | 亚洲一区久久久 | 欧美性受xxx| 国产精品九九九 | 亚洲欧美激情国产综合久久久 | 国产精品美女久久久久aⅴ国产馆 | 欧美国产日韩在线观看 | 波波电影院一区二区三区 | 国产精品免费看 | 午夜影晥 | 中文字字幕一区二区三区四区五区 |