Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting below error when trying to download a file from ftp.
System.Exception was caught HResult=-2147012893 Message=Exception from HRESULT: 0x80072EE3 Source=mscorlib StackTrace: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()


can anyone tell me what am I doing wrong ?
Thanks in advance!

What I have tried:

Below is the code I am using-

C#
public static async Task<bool> LargeDownLoad(string localsubfolders, string ftpURIInfo, string Username, string Password, string filename)
    {
        bool Successful = false;
        try
        {
            StorageFolder localFolderArea;
            BackgroundDownloader downloader = new BackgroundDownloader();
            // Open if exists as you cannot delete it if there are files in it.
            localFolderArea = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFolderAsync(localsubfolders, CreationCollisionOption.OpenIfExists);

            // create a storagefile which combines the localFolderArea with the filename of the local file.
            StorageFile localFilePath = await localFolderArea.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);

            Uri urlWithCredential; // = new Uri(ftpURIInfo + "/" + filename);
            bool Success = Uri.TryCreate(ftpURIInfo + "/" + filename, UriKind.Absolute, out urlWithCredential);

            if (!string.IsNullOrEmpty(Username.Trim()) &&
               !string.IsNullOrEmpty(Password.Trim()))
            {
                urlWithCredential = new Uri(urlWithCredential.ToString().ToLower().Replace(@"ftp://",
                    string.Format(@"ftp://{0}:{1}@",
                    Username,
                    Password)));
            }

            DownloadOperation download = downloader.CreateDownload(
                urlWithCredential,
                localFilePath);
            await download.StartAsync();

            Successful = true;

        }
        catch (Exception)
        {
            throw;
        }
        return Successful;
    }
Posted
Updated 17-Aug-16 21:38pm

1 solution

Error code 0x80072EE3 is ERROR_INTERNET_EXTENDED_ERROR.
This error occurs when receiving an error response from the server.

You can try to pass the HRESULT to BackgroundTransferError.GetStatus | getStatus Method (Windows)[^] to get the server error code.

See then the List of FTP server return codes - Wikipedia, the free encyclopedia[^] to know what happened.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900