We help IT Professionals succeed at work.

Downloading a file with FTP in ASP code is very very slow

shahzad73 asked
Last Modified: 2008-04-24

My team is trying to connect with a secure internet directory contents in classic ASP code. The FTP is connecting with user name and password. but it takes a lot of time (15 minutes) just to download a simple xml file. if i access the same directory with IE browser. it asks user name and password and when i enter it it logs in the directoy and shows the directory listing. if i then download a file from IE it takes only 5 seconds to download 70KB XML file. so the question why the classic ASP code taking so much time.

one thing that is the directory contains a lot of XML file around 800,000 so when i connect with IE to the directory then it takes a lot of time displying the whole directory contents. IS IT THE CASE with FTP connection in ASP code that it is also downloading that directory contents.

ASP code is give below

Shahzad Aslam

' Build our ftp-commands file
Set objTextFile = objFSO.CreateTextFile(Server.MapPath("test.ftp"))

objTextFile.WriteLine "lcd " & Server.MapPath(".")
objTextFile.WriteLine "open " & ftp_address
objTextFile.WriteLine ftp_username
objTextFile.WriteLine ftp_password

' Check to see if we need to issue a 'cd' command
If ftp_remote_directory <> "" Then
   objTextFile.WriteLine "cd " & ftp_remote_directory
End If

objTextFile.WriteLine "prompt"

' If the file(s) is/are binary (i.e. .jpg, .mdb, etc..), uncomment the following line
  objTextFile.WriteLine "binary"

' If there are multiple files to put, we need to use the command 'mput', instead of 'put'
If Instr(1, ftp_files_to_put, "*",1) Then
   objTextFile.WriteLine "mput " & ftp_files_to_put
   objTextFile.WriteLine "put " & ftp_files_to_put
End If

objTextFile.WriteLine "bye"

Set objTextFile = Nothing

' Use cmd.exe to run ftp.exe, parsing our newly created command file
strCMD = "ftp.exe -s:" & Server.MapPath("test.ftp")
strTempFile = "C:\" & oFileSys.GetTempName( )

oFileSys.copyfile ftp_address & ftp_remote_directory & ftp_files_to_put , "c:\1011.xml"
Watch Question

And, if you run this straight from the command prompt, is it faster that ASP?

ftp.exe -s:path/test.ftp

>one thing that is the directory contains a lot of XML file around 800,000
I would consider this to be the cause of the performance issue.

In any case, if you want to test with an FTP component (free version available):


Dear L00M     when i try to run through ftp.exe -s:path/test.ftp  it gives me error...  it even did not login

i have another things and that is the secure i am trying to access is through http not ftp. they have not open the ftp port   that is why i can login and access the directory through browser but not ftp

Any Clues
Shahzad Aslam


Dearddrudik:   they do not have any ASP code. also i can not install any activeX controls
This one is on us!
(Get your first solution completely free - no credit card required)

Can you give me an explanation of the C grade?

As stated here:

C: Because Experts' reliability are often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.

Considering you did not ask for clarification, I'm not sure why you gave that grade. Also note, other Experts may be reluctant to answer your questions after reviewing your profile if they see you clearly do not understand how EE operates. Please take time to familiarize yourself with that help page.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.