Results 1 to 12 of 12

Thread: [RESOLVED] Inet Control Stopped Working

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    2

    Resolved [RESOLVED] Inet Control Stopped Working

    I wrote a program in VB6 years ago that would load the contents of a web page, and send me a text message if there were any changes to the page. It has been running flawlessly on an old XP laptop for over 10 years, until recently. I am using the Inet control, like this:

    Inet.AccessType = icDirect
    rtxtSource.Text = Inet.OpenURL(Url)

    I don't know what has changed, but all of a sudden Inet is not returning a string, the contents are nul.

    So, I tried running the program on my Windows 7 machine to see what would happen, and the program works, but with one big difference. On my XP machine, when it was working and I saved the contents to a file, the file size was always 64k:

    temppage.txt 7/18/2009 Text Document 64KB

    Now it is:

    temppage.txt 10/6/2017 Text Document 0KB


    But, on the Windows 7 machine it is always:

    temppage.txt 10/6/2017 Text Document 14KB


    Before, the 64KB file on the XP machine represented a slightly truncated web page, but it contained all the information I needed. On the Windows 7 machine, the program is only returning 14KB of data, which is not enough information. Can anyone help with this please, and tell me: a)why did Inet suddenly stop working on my XP machine?, and b)why do I only get 14KB of data on my Windows 7 machine?

    Ideally I would like to be able to get this working on Windows 7 so that I can retire the old XP laptop, but if not and I can get it working again on XP, that would be great too. I should add that I also transferred the program to another old XP machine, and I get the same results on that one.

    I am a novice programmer, and only ever learned enough to be dangerous. Thanks in advance for any help.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    21,557

    Re: Inet Control Stopped Working

    That control has been obsolete for a very long time. About the only thing I might consider using for it FTP, since we don't have another readily available FTP control. Even then I'd probably look for a 3rd party alternative for FTP because it is so clunky to work with and lacks support for newer FTP features.

    One problem people have reported recently is that the control no longer works for HTTPS to many sites unless IE 11 is installed. That is probably because of changes to the SLL/TLS cipher suites in use as people move web servers away from supporting older ciphers that were too easy to exploit.

    If installing IE11 doesn't work I'm not sure what your problem might be. That isn't even an option on the dead Windows XP anyway as far as I know.


    Your best option is probably to rewrite using WinHttp 5.1, which has been part of Windows for a very long time now. Simple demo:

    Code:
    Option Explicit
    '
    'Reference to: Microsoft WinHTTP Services, version 5.1
    '
    'Requires Windows Vista, Windows XP SP1, or Windows 2000
    'Professional SP3 and later.
    '
    
    Private Sub Main()
        Dim HTTPRequest As WinHttp.WinHttpRequest
    
        Set HTTPRequest = New WinHttp.WinHttpRequest
        With HTTPRequest
            .Open "GET", "http://tycho.usno.navy.mil/cgi-bin/timer.pl", True
            .Send
            If .WaitForResponse(3) Then
                MsgBox .ResponseText
            Else
                MsgBox "Timed out after 3 seconds."
            End If
        End With
        Set HTTPRequest = Nothing
    End Sub
    See: WinHttpRequest object

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    2

    Re: Inet Control Stopped Working

    I can't thank you enough, this solution worked perfectly on my Windows 7 machine. Here is the new file size:

    temppage.txt 10/6/2017 Text Document 639KB

    I'll test it on XP later, and if I can't get it to work there then I'll use it as an excuse to upgrade to a Windows 7 laptop to run this program, which I leave running 24/7.

    Thank you so much again for your expert help.

  4. #4
    Lively Member
    Join Date
    Feb 2004
    Posts
    92

    Re: Inet Control Stopped Working

    Quote Originally Posted by dilettante View Post
    That control has been obsolete for a very long time. About the only thing I might consider using for it FTP, since we don't have another readily available FTP control. Even then I'd probably look for a 3rd party alternative for FTP because it is so clunky to work with and lacks support for newer FTP features.

    One problem people have reported recently is that the control no longer works for HTTPS to many sites unless IE 11 is installed. That is probably because of changes to the SLL/TLS cipher suites in use as people move web servers away from supporting older ciphers that were too easy to exploit.

    If installing IE11 doesn't work I'm not sure what your problem might be. That isn't even an option on the dead Windows XP anyway as far as I know.


    Your best option is probably to rewrite using WinHttp 5.1, which has been part of Windows for a very long time now. Simple demo:
    I can't get this code to work? i've been using INET previously, but realized that it's stopped working. All i want to do is to read a small text file from a url?
    /Jimboat

  5. #5
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,932

    Re: [RESOLVED] Inet Control Stopped Working


  6. #6
    Lively Member
    Join Date
    Feb 2004
    Posts
    92

    Re: [RESOLVED] Inet Control Stopped Working

    Quote Originally Posted by Arnoutdv View Post
    Try the URLDownloadToFile API:
    thanks for the reference. however, the URLDownloadToFile API seems to require that I save the downloaded file onto a file location on disk before I can read it into a String variable. i'd rather not have to save to user's disk. how can i simply read .txt file to string variable?
    Last edited by Jimboat; Apr 15th, 2020 at 02:27 PM.
    /Jimboat

  7. #7
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Posts
    2,313

    Re: [RESOLVED] Inet Control Stopped Working

    > how can i simply read .txt file to string variable?

    Is this like a second question? I thought you we trying to download something?

    > I can't get this code to work?

    dilettante's code is downloading from http://tycho.usno.navy.mil/cgi-bin/timer.pl which is a non-existent site nowadays, so no one can get it to work anymore.

    Tell us the exact URL you are trying to download something from. Is it using http or https protocl? Is it an http request that is redirecting to an https site? What version of Windows is this failure happening on?

    cheers,
    </wqw>

  8. #8
    Lively Member
    Join Date
    Feb 2004
    Posts
    92

    Re: [RESOLVED] Inet Control Stopped Working

    wqweto - sorry if i was confusing. i had been using INET to read a text file a web site that i manage. All i wish to do is read into a string variable the contents of a small text file on a web site url.
    Code:
     String = Inet1.OpenURL("http://www.xxx/update.txt")
    but then it just stopped working, and i realized that INET was perhaps just not supported any more.

    So i tried dilettante's code (post #2 above), but couldn't get it to work for any known website/file. i can't get dilettante's code to work on any known web site (like google.com)

    The desired file is a simple text file, which is now a https site. but i can't seem to find a routine that will work consistently on all url's. The routine doesn't work on any Windows version, as i've tested, but my VB6 is on a WinXP machine.

    Does the https/http designation alter the routine that must be used to dload or read a file? maybe this is one of my problems?
    /Jimboat

  9. #9
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Posts
    2,313

    Re: [RESOLVED] Inet Control Stopped Working

    You can try setting Inet1.Protocol = icHTTPS on your control first.

    You can try this simple function to download something off the internet to a string too. (No control required, should work both with http and https protocols.)

    Code:
    Option Explicit
    
    Private Sub Form_Load()
        Debug.Print DownloadToString("https://dl.unicontsoft.com/upload/test.txt")
    End Sub
    
    Private Function DownloadToString(sURL As String) As String
        With CreateObject("MSXML2.XMLHTTP")
            .Open "GET", sURL, False
            .Send
            DownloadToString = .ResponseText
        End With
    End Function
    The trouble with WinXP is that this legacy OS does not support newer (TLS 1.3 version) of the https protocol which renders half the internet inaccessible, depends on target site https configuration.

    If this is the case neither your Inet1 control nor the DownloadToString function above will work if the OS is missing the ciphers to decrypt this particular https traffic.

    cheers,
    </wqw>

  10. #10
    Lively Member
    Join Date
    Feb 2004
    Posts
    92

    Re: [RESOLVED] Inet Control Stopped Working

    Quote Originally Posted by wqweto View Post
    You can try setting Inet1.Protocol = icHTTPS on your control first.

    You can try this simple function to download something off the internet to a string too. (No control required, should work both with http and https protocols.)

    Code:
    Option Explicit
    
    Private Sub Form_Load()
        Debug.Print DownloadToString("https://dl.unicontsoft.com/upload/test.txt")
    End Sub
    
    Private Function DownloadToString(sURL As String) As String
        With CreateObject("MSXML2.XMLHTTP")
            .Open "GET", sURL, False
            .Send
            DownloadToString = .ResponseText
        End With
    End Function
    The trouble with WinXP is that this legacy OS does not support newer (TLS 1.3 version) of the https protocol which renders half the internet inaccessible, depends on target site https configuration.

    If this is the case neither your Inet1 control nor the DownloadToString function above will work if the OS is missing the ciphers to decrypt this particular https traffic.

    cheers,
    </wqw>
    wqweto - I really appreciate your helping with this.

    when i set Inet1.Protocol = icHTTPS, then the process will complete successfly with Win10 OS. But, Win7 (and WinXP) both fail, however. I would have expected that Win7 OS would be ok?

    if i simply use my browser to read the txt file, then works in all OS's. I don't understand enough about these different protocols to understand what should work?

    when i use your simple function 'DownloadToString', it works for some websites (https) but not for others? Is there something associated with the website hosting server that prevents INET? I'm really confused with how to get a reliable procedure?
    Last edited by Jimboat; Apr 16th, 2020 at 11:37 AM.
    /Jimboat

  11. #11
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Posts
    2,313

    Re: [RESOLVED] Inet Control Stopped Working

    > I'm really confused with how to get a reliable procedure?

    You simply can't. Windows XP and Win7 are unsupported already and newer https ciphers are *not* backported by Microsoft as no new Service Packs are shipped. Slowly the thermal death of these OSes will creep in when most of the internet becomes inaccessible by default IE browser and every application (VB6 incl.) that depend on system components for encryption. It's inevitable.

    I'm currently working on a solution for VB6 apps to support latest TLS 1.3 on every Windows version since NT4 independent of OS encryption support but it's not ready yet.

    cheers,
    </wqw>

  12. #12
    Lively Member
    Join Date
    Feb 2004
    Posts
    92

    Re: [RESOLVED] Inet Control Stopped Working

    Quote Originally Posted by wqweto View Post
    > I'm really confused with how to get a reliable procedure?

    You simply can't. Windows XP and Win7 are unsupported already and newer https ciphers are *not* backported by Microsoft as no new Service Packs are shipped. Slowly the thermal death of these OSes will creep in when most of the internet becomes inaccessible by default IE browser and every application (VB6 incl.) that depend on system components for encryption. It's inevitable.

    I'm currently working on a solution for VB6 apps to support latest TLS 1.3 on every Windows version since NT4 independent of OS encryption support but it's not ready yet.
    wqweto - thank you for your continuing explanations. i think i get it now. the discussed fixes have got me going with Win10, and there simply is NO solution to get it to work for Win7 and WinXP. OK. thanks for explaining it all for me.
    /Jimboat

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width