Re: inet, ftp, asp and hardship

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: McKirahan (News_at_McKirahan.com)
Date: 03/11/04

  • Next message: arvaco: "Re: inet, ftp, asp and hardship"
    Date: Thu, 11 Mar 2004 20:56:15 GMT
    
    

    "arvaco" <arvaco@hotmail.com> wrote in message
    news:eP#F9f4BEHA.2800@tk2msftngp13.phx.gbl...
    > I need to send an updated file to a remote server via ftp whenever
    > someone loads an asp page. I can do this with VB but when I tried the code
    > in asp I get one of those 'cannot coerce type' errors. Here's what I have
    so
    > far:
    >
    > Rfile = "traffic.htm"
    > Lfile = "C:\Inetpub\wwwroot\Traffic\traffic.htm"
    >
    > cmd = "PUT " & Lfile & " " & Rfile
    >
    > set inet = createobject("inetctls.inet")
    > inet.requesttimeout=60
    > inet.protocol=icFTP
    > Inet.URL = "ftp://TheURL/"
    > Inet.UserName = "myname"
    > Inet.Password = "mypassword"
    > inet.execute , cmd
    >
    > The code is oh so close to the VB code except I used inet.execute,
    > "DIR" to log on in the VB code. If I try the same routine in the asp
    code
    > it never stops executing the command.
    > I can do what I need done by shelling a VB program to send the file
    but
    > that just seems like the lazy way around something simple but I may have
    no
    > choice.
    > Can I actually do this in asp or is there some kind of security
    setting
    > to prevent this? Any help would be appreciated.

    Probably not much help but ...

    1) Try Server.CreateObject("InetCtls.Inet")
    or
           Try Server.CreateObject("InetCtls.Inet.1")

    2) Is "MSINET.OCX" available and registered on the Web server?

    I put your code in a VBS file and got the same error:

        Option Explicit
       '*
        Const cVBS = "uploader.vbs"
        Const cDIR = "c:\inetpub\wwwroot\traffic\"
        Const cFIL = "traffic.htm"
        Const cURL = "ftp://{domain}/{path}/"
        Const cUSR = "{username}"
        Const cPWD = "{password}"
       '*
        Dim strCMD
    ' strCMD = "put " & cDIR & cFIL & " " & cFIL
            strCMD = "dir"
        Dim strPWD
            strPWD = cPWD
        If strPWD = "" Then strPWD = InputBox("Password?","")
        If strPWD = "" Then WScript.Quit
       '*
        WScript.Echo strCMD
       '*
        Dim objNET
        Set objNET = CreateObject("InetCtls.Inet.1") '= MSInet.ocx
            objNET.RequestTimeout = 60
           'objNET.AccessType = 0 '= icUseDefault
            objNET.Protocol = 2 '= icFTP
           'objNET.RemotePort = 80
            objNET.URL = cURL
            objNET.UserName = cUSR
            objNET.Password = strPWD
            objNET.Execute, strCMD
       '*
        Do
    ' WScript.Echo "." ': uncomment if running via CScript
            WScript.Sleep 100
        Loop While objNET.StillExecuting
       '*
            objNET.Execute, "Close"
        Set objNET = Nothing
       '*
        WScript.Echo cVBS & " ended."

    I did a Google search on "Cannot coerce type" but found no answer.


  • Next message: arvaco: "Re: inet, ftp, asp and hardship"

    Relevant Pages