Click here to Skip to main content
11,709,366 members (43,688 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0 Azure Blob
i have files stored at azure blob. Now i want to transfer file directly form blob to ftp server.

i have tried this.
string ftpfullpath = @"";
                FtpWebRequest ftp = WebRequest.Create(ftpfullpath) as FtpWebRequest;
                if (ftp != null)
                    ftp.Credentials = new NetworkCredential("uname", "pass");
                    ftp.KeepAlive = false;
                    ftp.UseBinary = true;
                    ftp.Method = WebRequestMethods.Ftp.UploadFile;
                FileStream fs = File.OpenRead(blobfilePath.Replace("https","http"));
                byte[] buffer = new byte[fs.Length];
                fs.Read(buffer, 0, buffer.Length);
                Stream ftpstream = ftp.GetRequestStream();
                ftpstream.Write(buffer, 0, buffer.Length);
But am am getting an error 'URI formats are not supported'.

how can i achieve this..

Thanks in advance.
Posted 10-Feb-13 19:16pm
Edited 10-Feb-13 21:27pm
Sergey Alexandrovich Kryukov at 11-Feb-13 1:52am
Where is FTP here? Only HTTP...
Sergey Alexandrovich Kryukov at 11-Feb-13 2:34am
It does not look like a valid address...
Sergey Alexandrovich Kryukov at 11-Feb-13 3:08am
remove blank space before "ftp"...
Sergey Alexandrovich Kryukov at 11-Feb-13 4:40am
Oh... why do you replace HTTP with HTTPS what is the actual protocol? This should be a problem...
Guirec Le Bars at 11-Feb-13 5:47am
it is you File.OpenRead(blobfilePath.Replace("https","http")); which does not support URI formats.
To open your azure file you should do WebRequest.Create as well if it is distant or File.OpenRead but then with a path not a url.
anish.karunakaran at 12-Feb-13 6:31am
Thanks.. point strike.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

you're most welcome, Just answering here so that it's not appearing in unswanred questions.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 580
1 OriginalGriff 250
2 Maciej Los 225
3 Peter Leow 219
4 Mika Wendelius 160
0 OriginalGriff 9,428
1 Sergey Alexandrovich Kryukov 9,027
2 CPallini 5,189
3 Maciej Los 4,991
4 Mika Wendelius 3,856

Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 12 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100