473,778 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 URLDownloadToFi le, 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 1603
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******@hotma il.com> wrote in message
news:60******** *************** **@posting.goog le.com...
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 URLDownloadToFi le, 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******@hotma il.com> wrote in message
news:60******** *************** **@posting.goog le.com...
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 URLDownloadToFi le, 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 URLDownloadToFi le Lib "urlmon" Alias _
"URLDownloadToF ileA" (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.FileS ystemObject
Dim downloadResult as Long
Dim textFile As scripting.TextS tream

On Error GoTo GetFile_ERROR

'Get FSO for tests
Set myFSO = New scripting.FileS ystemObject

'Create log file
Set textFile = myFSO.CreateTex tFile("C:\temp\ gdsgetfile.log" )
textFile.WriteL ine "Starting log " & CStr(Now)

'Check if it is already there, then don't need it
If myFSO.FileExist s(destPath) Then
textFile.WriteL ine "Found the file at the beginning"
GetFile = True
Else
'File doesn't currently exist
textFile.WriteL ine "Trying to download the file"
downloadResult = URLDownloadToFi le(0, getURL, destPath, 0,
0)
If downloadResult = 0 Then
textFile.WriteL ine "Download noted successful to " &
Chr(34) & myResult & Chr(34) & ", checking for the file"
GetFile = myFSO.FileExist s(destPath)
If GetFile Then
textFile.WriteL ine "Found the file"
Else
textFile.WriteL ine "File not found where expected"
End If
Else
textFile.WriteL ine "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.WriteL ine "Encountere d 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.CreateOb ject("MyGetFile .GetFile")

gotFile = ws.GetFile("htt p://www.google.com/images/logo.gif",
"C:\Temp\go ogle-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
6128
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 downloads. It uses fpassthru() and some headers() to send a file to the requesting user. The get.php file that I wrote (the file download module if you will) works like a charm for .ZIP files and .TXT files. However, when .EXE files are downloaded...
11
2425
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 PHP script, pasted below. IE users are fine, but Mozilla users actually see the file contents on screen, as garbage, instead of being presented with the "save as" dialog.
2
5244
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 that servers my files. I'm currently using header("Location: abc.com") to redirect my users to this other site but can't force a download. I can get it to work using readfile() but that means the file moves from the high-speed server through my...
0
2326
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 (current release version is 0.4.8), but you should get a very good idea of what it's about by visiting the site (which uses it, funnily enough), or downloading a copy of it and trying it out.
14
2200
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 this possible with ASP.NET(C#)? Thanks Aaron
12
2848
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 && function_exists('imagecreatetruecolor') && preg_match('/2\.0/i', $this->gd_info_array)) { $newImage = @imagecreatetruecolor($configArray, $configArray);
5
1639
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 the web pages from the server because there is not available bandwidth. Is there any way to decrease the download speed of this file by reading pieces of the file and manually send each piece every 100 milliseconds in order to control the speed of...
4
1462
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 misled by some of the sleazy MVPs and the lying cockroaches that Microsoft has working for the company... Microsoft has serious problems with their servers and websites. The entire MSDN server farm and all download resources MSDN manages has been...
1
47485
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 on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5368
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.