473,378 Members | 1,617 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

ASP to download from one website to another

I am trying to download files from one website to another for purposes
of caching. In trying to do this, I created a VB dll component (using
VB6), that used URLDownloadToFile, to allow me to download the file
onto the receiving site. The sending site supports an ASP page that
allows the file to be downloaded.

The component works fine when run in debugging mode, placing the file
as expected. But when not debugging (but registered), it reports that
the file has been downloaded, but the file is not there.

I would be happy with a fix or a better solution.
Jul 19 '05 #1
3 1580
Hi Brent,

I'm not trying to turn you away from this group or anything, but I think
that you'll have much better luck getting help with this if you take it to a
VB group. If a component doesn't perform the task it's suppose to perform,
ASP code will likely not help you. Unless, of course, if you have On Error
Resume Next in there or it's an IIS permissions issue.

Ray at home

"Brent Billups" <rb******@hotmail.com> wrote in message
news:60*************************@posting.google.co m...
I am trying to download files from one website to another for purposes
of caching. In trying to do this, I created a VB dll component (using
VB6), that used URLDownloadToFile, to allow me to download the file
onto the receiving site. The sending site supports an ASP page that
allows the file to be downloaded.

The component works fine when run in debugging mode, placing the file
as expected. But when not debugging (but registered), it reports that
the file has been downloaded, but the file is not there.

I would be happy with a fix or a better solution.

Jul 19 '05 #2
Can you post the code your using to download and save the file? (will make
it much easier to diagnose for you)

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Brent Billups <rb******@hotmail.com> wrote in message
news:60*************************@posting.google.co m...
I am trying to download files from one website to another for purposes
of caching. In trying to do this, I created a VB dll component (using
VB6), that used URLDownloadToFile, to allow me to download the file
onto the receiving site. The sending site supports an ASP page that
allows the file to be downloaded.

The component works fine when run in debugging mode, placing the file
as expected. But when not debugging (but registered), it reports that
the file has been downloaded, but the file is not there.

I would be happy with a fix or a better solution.

Jul 19 '05 #3
I think this is an ASP or IIS related problem, because it the VB code
works fine when the component is run stand-alone or in debug mode for
the ASP; it only fails when used in an ASP page.

Here is the code to see if that helps. There have been minor name
changes from the original, (to protect the guilty ;->) The sample ASP
page just attempts to download the google logo to the temp directory
on the C: drive.
I added logging to the VB code to try to diagnose the problem. The
logging works fine, notes no error from the download, but the file
isn't present.

VB Code (from the file GetFile.cls):

'Declare from the API
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String,
ByVal _
szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As
Long) As Long

Public Function GetFile(getURL As String, destPath As String) As
Boolean
Dim myFSO As scripting.FileSystemObject
Dim downloadResult as Long
Dim textFile As scripting.TextStream

On Error GoTo GetFile_ERROR

'Get FSO for tests
Set myFSO = New scripting.FileSystemObject

'Create log file
Set textFile = myFSO.CreateTextFile("C:\temp\gdsgetfile.log")
textFile.WriteLine "Starting log " & CStr(Now)

'Check if it is already there, then don't need it
If myFSO.FileExists(destPath) Then
textFile.WriteLine "Found the file at the beginning"
GetFile = True
Else
'File doesn't currently exist
textFile.WriteLine "Trying to download the file"
downloadResult = URLDownloadToFile(0, getURL, destPath, 0,
0)
If downloadResult = 0 Then
textFile.WriteLine "Download noted successful to " &
Chr(34) & myResult & Chr(34) & ", checking for the file"
GetFile = myFSO.FileExists(destPath)
If GetFile Then
textFile.WriteLine "Found the file"
Else
textFile.WriteLine "File not found where expected"
End If
Else
textFile.WriteLine "Failed to download the file"
GetFile = False
End If
End If

textFile.Close
Set textFile = Nothing

Exit Function

GetFile_ERROR:
On Error Resume Next
If Not textFile is Nothing Then
textFile.WriteLine "Encountered error #" & CStr(Err.Number)
& " - " & Err.Description & " @ " & Err.Source
End If
Err.Clear
GetFile = False
End Function
ASP Code (from file GetFile.asp):

<%@ Language = "VBScript" %>
<% Response.Buffer = True %>
<html>

<%

Dim ws
Dim gotFile

Set ws = Server.CreateObject("MyGetFile.GetFile")

gotFile = ws.GetFile("http://www.google.com/images/logo.gif",
"C:\Temp\google-logo.gif")
If gotFile Then
Response.Write "Got File."
Else
Response.Write "Failed to get file."
End If

Set ws = Nothing

%>

</HTML>
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily...
11
by: Jim Willsher | last post by:
Hi all, PHP 4.2.2 on RedHat9 I have some files on my website for people to download, and I want to generate the file location "on the fly", so the URL is held in a database. I have a simple...
2
by: Matthew Sims | last post by:
Is it possible to force a download without using the readfile function? My website setup consists of my server that serves the web pages plus a high-speed file server elsewhere on the internet...
0
by: jonathan.beckett | last post by:
Hi All, I have just made version 0.4.8 of the PluggedOut CMS Content Management System available for download - it's free, and covered by the GPL. It's still very much a work in progress...
14
by: Aaron | last post by:
On my website I have a dynamic link(aspx) to this file 0AX120S.jpg(privacy protection). When a visitor clicks on the link I want them to see my_vacation_pic.jpg (fetch realname from database) is...
12
by: comp.lang.php | last post by:
index.php: // STUFF // STEP 1: imagecreatetruecolor ONLY IF GD 2.0+ SUPPORTED AND FOUND if ($this->isSuccessful && !$hasMogrified && $image && !$newImage &&...
5
by: Pitaridis Aristotelis | last post by:
I have a large file which has to be downloaded from a user using the Internet Explorer. The problem is that when someone downloads this file, the server slows down and the other users can not see...
4
by: clintonG | last post by:
To all Microsoft partners and customers who have been unable to download recently or access ASP.NET documentation from the msdn2 website and for all of those customers who have been lied to and...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.