Library tutorials & articles

Using the Inet Control

Introduction

This article will show you how to create a server component using Internet Transfer Control. I shall talk about the ITC (Internet Transfer Control) in more detail shortly but first of all let's see why do we need this component. This component can be used to download files from the Internet especially the image files. You might find some download components on the Internet which will allow you to download text or html files but have you ever tried to download a binary file with such components? This component will show you how to download binary files from the Internet. The component was created in VB and has been tested in both VB and ASP. You can download images from your local intranet as well as from the remote sites. Today's applications are expected to extend their reach globally. An application should be able to download files from any computer connected to the Internet. Luckily, Microsoft has created an ActiveX control that makes accessing files on the Internet much easier.

Comments

  1. 15 Nov 2006 at 06:34

    Dear all,

    how if i want to post data http using inet ? please give me how to step by step ..

    how to using inet

    thank u so much

    uniwaly

    uniwaly[at]gmail.com

  2. 24 Sep 2004 at 20:51

    how would i use Inet to connect to a website... as in a yahoo website? say i want to use inet to log in to yahoo...


    i would have text1 be the username. text2 the password, and then use a command button that when it is clicked, it will log me into yahoo on whatever server i would choose.... i am not good at Inet so a full code would be good... with the server http://login.yahoo.com/config/login

  3. 09 Aug 2003 at 00:13

    i have some errors in this program.When i download the pdf files from the remote server,it's ok.But exe and zip file are not ok.When zip files are downloaded,Time out error shows and exe files show server not found.So i can't  solve this problem and i think it takes much time to download the pdfs which sizes are round about 500 k or more.So i would like to know that problem and then i would like to know the way of the executes method and get data  and save in the desired location with executes.

  4. 04 Oct 2002 at 21:46

    okay give me a few hours and i'll do a bit o research and get back to you on that....


    its very strange behaviour if its from VSI... PD i'd understand... wierd!

  5. 04 Oct 2002 at 21:10

    Quote:

    what did you use to distribute this again? was it PD wziard or VSI?


    Yes


    First I tried VSI, then when that didn't work right I tried the PD wizard. When I fixed the component registration one computer had it installed with VSI and the other with the PD wizard, so BOTH methods had the same problem.

  6. 04 Oct 2002 at 20:53

    COM is a pain. I've had alot of issues with registering new versions of components because of the compatibility settings etc.


    what did you use to distribute this again? was it PD wziard or VSI?


  7. 04 Oct 2002 at 12:16

    One of the computers is Win2k, the other is Win XP Pro. (Both had the same problem, both fixed the same way)


    So how would one go about fixing it if it is the com server? (I'll be looking into it myself, but have never messed with that type of thing before, stupid classes never tought us about distribution)

  8. 04 Oct 2002 at 12:00

    hmmm it looks like an installation issue then... the COM server may have the 'Self Register' attribute set or something...


    I thought your using Windows 2000 so i told you WinNT folder... yes under Windows XP and now Windows.NET its back to 'Windows\System32'!


  9. 03 Oct 2002 at 19:47

    MSINET.OCX was already in that directory, unregistered and reregistered and it now works. (does this mean the installer wasn't registering it like it is suposed to? If so, what can be done to fix this in the installer?)



    -- Note, I did this with both computers with IIS, the one on the XP Pro computer it was under Windows\system32, as it doesn't have a WINNT folder --

  10. 03 Oct 2002 at 19:16

    okay this is what i want you to do...


    get your MSINET.OCX file and place it in the winnt/system32 folder(your running IIS right?) then goto


    Start>Run type  in 'Command' enter 'regsvr32 /u " and the path to the OCX file... then do the same except without the "/u" and then it will tell you if it was successfully registered.


    do this on the server side.

  11. 03 Oct 2002 at 12:05

    I should probably add that I have gotten the control to work when placed on a form in a standard VB executable project. (mind, I didn't try installing that one on a different computer, but it worked on the computer Visual Studio is on)

  12. 03 Oct 2002 at 12:02

    I'm hosting it myself. As for properly registering the MSINET.OCX, no clue, I didn't do anything special in reguards to it when I installed Visual Studio. I Used the Package and Deployment Wizard instead and it had the exact same problem. I opened the Setup.Lst file and the MSINET.OCX file was listed in there. Here is the contents of that file:


    Code:


    [Bootstrap]
    SetupTitle=Install
    SetupText=Copying Files, please stand by.
    CabFile=wwHTML.CAB
    Spawn=Setup1.exe
    Uninstal=st6unst.exe
    TmpDir=msftqws.pdw
    Cabs=1


    [Bootstrap Files]
    File1=@VB6STKIT.DLL,$(WinSysPathSysFile),,,7/15/00 1:00:00 AM,101888,6.0.84.50
    File2=@COMCAT.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,5/31/98 1:00:00 AM,22288,4.71.1460.1
    File3=@STDOLE2.TLB,$(WinSysPathSysFile),$(TLBRegister),,6/3/99 1:00:00 AM,17920,2.40.4275.1
    File4=@ASYCFILT.DLL,$(WinSysPathSysFile),,,3/8/99 1:00:00 AM,147728,2.40.4275.1
    File5=@OLEPRO32.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,3/8/99 1:00:00 AM,164112,5.0.4275.1
    File6=@OLEAUT32.DLL,$(WinSysPathSysFile),$(DLLSelfRegister),,4/12/00 1:00:00 AM,598288,2.40.4275.1
    File7=@msvbvm60.dll,$(WinSysPathSysFile),$(DLLSelfRegister),,8/18/01 5:00:00 AM,1388544,6.0.92.37


    [Setup]
    Title=wwTools
    DefaultDir=$(ProgramFiles)\wwTools
    AppExe=wwHTML.dll
    AppToUninstall=wwHTML.dll


    [Setup1 Files]
    File1=@MSINET.OCX,$(WinSysPath),$(DLLSelfRegister),$(Shared),5/22/00 1:00:00 AM,115920,6.0.88.62
    File2=@wwHTML.dll,$(AppPath),$(DLLSelfRegister),,10/3/02 8:42:03 AM,24576,1.0.0.0


    ; The following lines may be deleted in order to obtain extra
    ; space for customizing this file on a full installation diskette.
    ;
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXX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XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    ; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX



  13. 29 Sep 2002 at 23:35

    that extension with M is MSM aka MicroSoft Mergemodule...


    I had at it on that page you sent me....


    Firstly, do you have full access to the server? As in ar eyou hosting it or is some comapny doing it?


    secondly did you proeprly register the msinet.ocx COM component?




  14. 29 Sep 2002 at 22:52

    The relivent code is realy simple:


    Code:

    Public Function GetHtml(sURL as string) as string
    GetHtml = Inet1.OpenURL(sURL)
    End Function


    This function takes a string and as you can see, calls the Inet control's OpenURL function using the passed URL. The returned value is the source code of the requested document.


    I had to stop the IIS prosses because I couldn't delete the old DLL while it was running (file in use error).


    The dependency wasn't listed as an OCX in the Installer program (it was listed as some extention with an M, can't remember it, and am on a different computer ATM). Note, I also installed it on my XP Pro computer and got the same error. (the XP Pro one has VS .NET installed.) The version of VS I'm using to create this is VS 6 Pro, the version of .NET on my XP Pro computer is .NET Academic (full Proffesional version with Academic tools).


    The precice error is as follows:

    Quote:

    Error Type:
    wwTools (0x800A0153)
    Component 'MSINET.OCX' or one of its dependencies not correctly registered: a file is missing or invalid
    /test1/html.asp, line 8


    If you care to see the error for yourself (and if my DNS is functioning properly) visit my HTLM retrieval Test Page It is suposed to retrieve the Google home page source code and display the page.


    My DNS is working on my end, still don't know if it's working for off of my local network.

  15. 29 Sep 2002 at 19:48

    the MSINET.OCX is what your after... not the DLL...


    I dont understand why the IIS process should be stopped and restarted? We distributed this same file and had no problem what so ever. I have heard of a licensing issue on some distribution of VS or VB what distro have you got? We're got VS6 Enterprise so if you have any Enterprise distros your not likely to have any problems.


    What exactly does your application do?

  16. 29 Sep 2002 at 12:17

    Thanks for the suggestion, tried that after I read this, even varified that the msinet was added as a dependency. Unfortunatly, even after unregistering the dll and running the new installer I got the same error. (always stopping the IIS service before removing and restarting after installing). I'm thinking at this point it's a problem with the computer I'm installing it on. (it's running Win2K, but it's a fairly old computer). Unfortunatly the only other computer in the house with IIS running is a Win XP pro computer with .Net installed. Not very good for testing weather it would work or not after distribution.

  17. 29 Sep 2002 at 08:21

    what you need to do is to redistribtue the file 'MSINET.OCX' and register the COM Server on their machine... I recommed you go and download Microsoft Visual Studio Installer 1.1 and use that to distribtue your application, its build on MSI technology giving your users the abilty to remove and 'goback/repair' failed installations...


    URL : http://msdn.microsoft.com/vstudio/downloads/tools/vsi11/default.asp


    Good Luck!

  18. 29 Sep 2002 at 03:50

    Mind you, I'm not doing exactly what this example shows. (I'm creating a simple control to retrieve the contents of a remote web page, simple 1 function accepts 1 string, the URL, and returns the contents). However, this would be a problem even if I did exactly what the example project was depicting. The problem is when I registered the DLL on a different computer (the computer with VS 6 doesn't have IIS) and set up a simple asp page I got the following error:


    "Error Type:
    wwTools (0x800A0153)
    Component 'MSINET.OCX' or one of its dependencies not correctly registered: a file is missing or invalid"


    My project is wwTools (will be a collection of tools eventualy). I did install the VB Runtime DLL's obtained from Microsoft and still I get this error.


    What exactly am I missing? What do I need to do to get this to work on a computer without VS 6?

  19. 18 Feb 2002 at 08:36

    Sorry... I think that's a typo. Try objHTTP.Protocol = icHTTP. I'll update the tutorial asap

  20. 11 Dec 2001 at 13:39

    I got error.


    Code:
    objHTTP.Protocol1 = icHTTP

       Error: Method or data member not found



    I can't find a way to fix this problem. Maybe somebody could send me complete project of that?

  21. 01 Jan 1999 at 00:00

    This thread is for discussions of Using the Inet Control.

Leave a comment

Sign in or Join us (it's free).

S.S. Ahmed S.S. Ahmed is a senior IT Professional and works for a web and software development firm. Ahmed is a Microsoft Office SharePoint Server MVP. Ahmed specializes in creating database driven dynamic we...

Related discussion

Related podcasts

  • Christian Beauclair

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...

Want to stay in touch with what's going on? Follow us on twitter!