473,569 Members | 3,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

a97 - problem transfer file from server with https

Hi NG,

I used the Internet Data Transfer Library of Dev Ashish found at
http://www.mvps.org/access/modules/mdl0037.htm to transfer text files from
a server with HTTPS in my old Ms Access 97 application.

'----snip----
Sub TestHTTP()
On Error GoTo ErrHandler
Dim objHTTP As InetTransferLib .HTTP
Const conTARGET = "https://ip.of.my.server/PathToMyFile/MyFile.csv"

Set objHTTP = New InetTransferLib .HTTP
With objHTTP
.HttpURL = conTARGET
.DestinationFil e = "c:\MyFile. csv"
If .FileExists Then .OverwriteTarge t = True
.ConnectToHTTPH ost
.WriteHTTPDataT oFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmd RemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description , vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub

This code was running fine for months - I did not changed anything but for
a couple of days I receive an error 6 - overflow message when
..WriteHTTPData ToFile is in progress.

The file size of MyFile.csv is about 100-250kb...

I tried to use the microsoft internet transfer control activex v6.0 but
with no success... ;-(

Any help or sample code is welcome

Regards

Hanspeter
Jan 6 '06 #1
6 3398
IIRC there is a bug in the INetTransferLib .

In the WriteHTTPDataTo File and the WriteFTPDataToF ile ther is a line which
looks like this
Call apiWriteFile(hF ile, abytData(0), MAX_CHUNK, _
lngBytesWritten , 0&)
Which should be this
Call apiWriteFile(hF ile, abytData(0), lngBytesRead, _
lngBytesWritten , 0&)


--
Terry Kreft

"Hanspeter Leupin" <le***@csi.co m> wrote in message
news:1l******** *************** ******@40tude.n et...
Hi NG,

I used the Internet Data Transfer Library of Dev Ashish found at
http://www.mvps.org/access/modules/mdl0037.htm to transfer text files from
a server with HTTPS in my old Ms Access 97 application.

'----snip----
Sub TestHTTP()
On Error GoTo ErrHandler
Dim objHTTP As InetTransferLib .HTTP
Const conTARGET = "https://ip.of.my.server/PathToMyFile/MyFile.csv"

Set objHTTP = New InetTransferLib .HTTP
With objHTTP
.HttpURL = conTARGET
.DestinationFil e = "c:\MyFile. csv"
If .FileExists Then .OverwriteTarge t = True
.ConnectToHTTPH ost
.WriteHTTPDataT oFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmd RemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description , vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub

This code was running fine for months - I did not changed anything but for
a couple of days I receive an error 6 - overflow message when
.WriteHTTPDataT oFile is in progress.

The file size of MyFile.csv is about 100-250kb...

I tried to use the microsoft internet transfer control activex v6.0 but
with no success... ;-(

Any help or sample code is welcome

Regards

Hanspeter

Jan 6 '06 #2
Red
I love Dev's coding...

But, I would guess that the file being written is to big... but,
honestly, this is just a guess
~Red

Jan 7 '06 #3
Hi Terry,

Thanks for your replay.

On Fri, 6 Jan 2006 16:29:36 -0000, Terry Kreft wrote:
Call apiWriteFile(hF ile, abytData(0), MAX_CHUNK, _
lngBytesWritten , 0&)
Which should be this
Call apiWriteFile(hF ile, abytData(0), lngBytesRead, _
lngBytesWritten , 0&)

I replaced MAX_CHUNK with lngBytesRead... well the overflow error is gone -
but the download of the file doesn't work. The code loops for ever at the
line where I did the change. The progress bar doesn't move and the filesize
of my 20kb file stays at 0...

lngTotalBytesWr itten = 0
'Read in MAX_CHUNK Chunk
Do
ReDim abytData(MAX_CH UNK)
lngRet = apiInetReadFile (hURL, abytData(0), MAX_CHUNK, lngBytesRead)
Call apiWriteFile(hF ile, abytData(0), lngBytesRead, _
lngBytesWritten , 0&)
lngTotalBytesWr itten = lngTotalBytesWr itten + lngBytesWritten
Call SysCmd(acSysCmd UpdateMeter, CInt(lngTotalBy tesWritten / mlngSize))
Loop Until lngRet <> 0 And lngBytesRead = 0
Any ideas or is there something missing ?

Hanspeter
Jan 7 '06 #4
On 6 Jan 2006 07:45:41 -0800, Red wrote:
I love Dev's coding...

But, I would guess that the file being written is to big... but,
honestly, this is just a guess
~Red


Hi Red,

well the code was fine till two weeks ago. The filesize was always in the
same range...

Is there no other code to transfer a file from https with a97?

Regards

Hanspeter
Jan 7 '06 #5
OK, there's something else going on.

Firstly don't worry about the file size staying at zero, IIRC the file size
doesn't get written until the download is finished.

I've tested this and it works fine.

The relevant piece of code I have in WriteHTTPDataTo File is :-
lngTotalBytesWr itten = 0
'Read in MAX_CHUNK Chunk
Do
ReDim abytData(MAX_CH UNK)
lngRet = apiInetReadFile (hURL, _
abytData(0), _
MAX_CHUNK, _
lngBytesRead)
Call apiWriteFile(hF ile, abytData(0), lngBytesRead, _
lngBytesWritten , 0&)
lngTotalBytesWr itten = lngTotalBytesWr itten + lngBytesWritten
Call SysCmd(acSysCmd UpdateMeter, CInt(lngTotalBy tesWritten / mlngSize))
Loop Until lngRet <> 0 And lngBytesRead = 0
I'm call ing the routine as follows
Sub TestHTTP()
On Error GoTo ErrHandler
Dim objHTTP As InetTransferLib .HTTP
Const conTARGET = "http://www.mvps.org/access/acknowledge.htm "

Set objHTTP = New InetTransferLib .HTTP
With objHTTP
.HttpURL = conTARGET
.DestinationFil e = "C:\test.ht m"
If .FileExists Then .OverwriteTarge t = True
.ConnectToHTTPH ost
.WriteHTTPDataT oFile
End With
ExitHere:
On Error Resume Next
Set objHTTP = Nothing
Call SysCmd(acSysCmd RemoveMeter)
Exit Sub
ErrHandler:
MsgBox Err.Number & vbCrLf & Err.Description , vbCritical + vbOKOnly,
Err.Source
Resume ExitHere
End Sub

and this works. (the file created is 73.5 kb).

In the WriteHTTPDataTo File procedure try keeping a track of
lngBytesRead this should be at most MAX_CHUNK
lngBytesWritten this should be at most lngBytesRead
lngTotalBytesWr itten this should be at most the size of your file in
bytes.

--
Terry Kreft

"Hanspeter Leupin" <le***@csi.co m> wrote in message
news:rw******** *************** *****@40tude.ne t...
Hi Terry,

Thanks for your replay.

On Fri, 6 Jan 2006 16:29:36 -0000, Terry Kreft wrote:
Call apiWriteFile(hF ile, abytData(0), MAX_CHUNK, _
lngBytesWritten , 0&)
Which should be this
Call apiWriteFile(hF ile, abytData(0), lngBytesRead, _
lngBytesWritten , 0&)

I replaced MAX_CHUNK with lngBytesRead... well the overflow error is
gone -
but the download of the file doesn't work. The code loops for ever at the
line where I did the change. The progress bar doesn't move and the
filesize
of my 20kb file stays at 0...

lngTotalBytesWr itten = 0
'Read in MAX_CHUNK Chunk
Do
ReDim abytData(MAX_CH UNK)
lngRet = apiInetReadFile (hURL, abytData(0), MAX_CHUNK, lngBytesRead)
Call apiWriteFile(hF ile, abytData(0), lngBytesRead, _
lngBytesWritten , 0&)
lngTotalBytesWr itten = lngTotalBytesWr itten + lngBytesWritten
Call SysCmd(acSysCmd UpdateMeter, CInt(lngTotalBy tesWritten / mlngSize))
Loop Until lngRet <> 0 And lngBytesRead = 0
Any ideas or is there something missing ?

Hanspeter

Jan 7 '06 #6
On Sat, 7 Jan 2006 12:17:29 -0000, Terry Kreft wrote:
OK, there's something else going on.

Firstly don't worry about the file size staying at zero, IIRC the file size
doesn't get written until the download is finished.

I've tested this and it works fine.

Const conTARGET = "http://www.mvps.org/access/acknowledge.htm "

and this works. (the file created is 73.5 kb).


Hi Terry,

I checked all the code and I tried the sample you did and it works fine
too! The download of http://www.mvps.org/access/acknowledge.htm worked...
but when I go back to my https page on the intranet the download breaks and
loops for ever... I reinstalled the certificates...

When ever IE was in the background open to the secure page - access97
successfully downloaded the files...

Well - we can keep on right click the files and store them localy... :-)

Reagrds

Hanspeter
Jan 7 '06 #7

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

Similar topics

1
8118
by: JT | last post by:
i'm using a model, view, control architecture for a group of .asp pages. i can't decide whether to use Server.Transfer or Server.Execute to pass posted data from my control to my model. are there security implications for using Server.Execute? just wanting some advice on pros/cons to each of these since this is the first time i'm...
1
2699
by: Marwan Abi Khalil via DotNetMonster.com | last post by:
hello, i want to send an XML file over https using POST method (httpwebrequest) if anyone can provide me with some code would be gr8 coz i tried so manything and everytime i get the 500 error code reffering to Server Error :: Protocol ERROR please notify me @ marwan.ak@gmail.com
4
1461
by: Logidec | last post by:
What is better method to transfer file to PocketPC from PC ? Thank
4
2291
by: ewolfman | last post by:
Hi, This may sound a little complicated, but here goes: I have 2 webforms (lets call them 'x' and 'y'). * - 'x' is a form which contains a single server side TextBox web control, and an iframe. The iframe's src attribute references the 'y' webform.
4
3225
by: Mark Olbert | last post by:
I'm looking for help in getting the Transfer Sql Server Objects task to work. The goal is to transfer the tables, views, sprocs, udfs from a SqlServer 2000 database to a Sql Server 2005 database. When I set the task up and run it, it fails complaining about an invalid foreign key relation. The relation in question is valid, and used in the...
9
3000
by: TC | last post by:
Like a lot of database developers, I often choose Jet for the back- end. I'm starting to worry about what will happen when Jet is deprecated. Ostensibly, Jet users like me must switch to SQL Server (or MSDE / SQL Express), but there's something I just don't understand. Without Jet, how will we create file server database applications? In...
3
2167
by: gaurav92K | last post by:
sir, please tell me how can we transfer file through netmetting in xp.
8
4620
by: sganeshsvk | last post by:
sir, i want to transfer the file and folders from Linux OS to WindowsXP OS... plz send Linux Command for transfer file and folders from Linux OS to WindowsXP OS ...
0
1436
by: sganeshsvk | last post by:
sir, i want to transfer the file and folders from Linux OS to WindowsXP OS... plz send Linux Command for transfer file and folders from Linux OS to WindowsXP OS ...
0
7619
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
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...
0
7983
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...
0
6290
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...
0
5228
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...
0
3662
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...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1229
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.