Problem using cmd.exe from asp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Derek Timothy

    Problem using cmd.exe from asp

    Hi folks I have strange problem using cmd.exe from asp code

    I am trying to save the results of an FTP command into a text file. When I
    run this command from the command line of the web server it creates the text
    file OK and it contains the results of the FTP commands.

    ftp.exe -s:test.ftp > c:\tempfile.txt

    However when I run it from asp using cmd.exe, it creates the file
    c:\tempfile.txt but there is nothing in it.

    set oScript=Server. CreateObject("W SCRIPT.SHELL")
    oScript.run("cm d.exe /c ftp.exe -s:test.ftp > c:\tempfile.txt ")

    Any ideas why?

    Thanks a lot,

    Derek


  • Curt_C [MVP]

    #2
    Re: Problem using cmd.exe from asp

    Derek Timothy wrote:[color=blue]
    > Hi folks I have strange problem using cmd.exe from asp code
    >
    > I am trying to save the results of an FTP command into a text file. When I
    > run this command from the command line of the web server it creates the text
    > file OK and it contains the results of the FTP commands.
    >
    > ftp.exe -s:test.ftp > c:\tempfile.txt
    >
    > However when I run it from asp using cmd.exe, it creates the file
    > c:\tempfile.txt but there is nothing in it.
    >
    > set oScript=Server. CreateObject("W SCRIPT.SHELL")
    > oScript.run("cm d.exe /c ftp.exe -s:test.ftp > c:\tempfile.txt ")
    >
    > Any ideas why?
    >
    > Thanks a lot,
    >
    > Derek
    >
    >[/color]
    just a guess but permission to FTP.EXE?

    --
    Curt Christianson
    site: www.darkfalz.com
    blog: blog.darkfalz.c om

    Comment

    • Derek Timothy

      #3
      Re: Problem using cmd.exe from asp

      Curt,

      It was worth a try, but sadly I get the same problem

      Am I adding permission to the correct account IUSR_ANON?

      Best Regards,
      Derek




      "Curt_C [MVP]" <software_at_da rkfalz.com> wrote in message
      news:%23zYcCOcb FHA.2900@TK2MSF TNGP15.phx.gbl. ..[color=blue]
      > Derek Timothy wrote:[color=green]
      > > Hi folks I have strange problem using cmd.exe from asp code
      > >
      > > I am trying to save the results of an FTP command into a text file. When[/color][/color]
      I[color=blue][color=green]
      > > run this command from the command line of the web server it creates the[/color][/color]
      text[color=blue][color=green]
      > > file OK and it contains the results of the FTP commands.
      > >
      > > ftp.exe -s:test.ftp > c:\tempfile.txt
      > >
      > > However when I run it from asp using cmd.exe, it creates the file
      > > c:\tempfile.txt but there is nothing in it.
      > >
      > > set oScript=Server. CreateObject("W SCRIPT.SHELL")
      > > oScript.run("cm d.exe /c ftp.exe -s:test.ftp > c:\tempfile.txt ")
      > >
      > > Any ideas why?
      > >
      > > Thanks a lot,
      > >
      > > Derek
      > >
      > >[/color]
      > just a guess but permission to FTP.EXE?
      >
      > --
      > Curt Christianson
      > site: www.darkfalz.com
      > blog: blog.darkfalz.c om[/color]


      Comment

      • Curt_C [MVP]

        #4
        Re: Problem using cmd.exe from asp

        Derek Timothy wrote:[color=blue]
        > Curt,
        >
        > It was worth a try, but sadly I get the same problem
        >
        > Am I adding permission to the correct account IUSR_ANON?
        >
        > Best Regards,
        > Derek
        >
        >
        >
        >
        > "Curt_C [MVP]" <software_at_da rkfalz.com> wrote in message
        > news:%23zYcCOcb FHA.2900@TK2MSF TNGP15.phx.gbl. ..
        >[color=green]
        >>Derek Timothy wrote:
        >>[color=darkred]
        >>>Hi folks I have strange problem using cmd.exe from asp code
        >>>
        >>>I am trying to save the results of an FTP command into a text file. When[/color][/color]
        >
        > I
        >[color=green][color=darkred]
        >>>run this command from the command line of the web server it creates the[/color][/color]
        >
        > text
        >[color=green][color=darkred]
        >>>file OK and it contains the results of the FTP commands.
        >>>
        >>>ftp.exe -s:test.ftp > c:\tempfile.txt
        >>>
        >>>However when I run it from asp using cmd.exe, it creates the file
        >>>c:\tempfile. txt but there is nothing in it.
        >>>
        >>>set oScript=Server. CreateObject("W SCRIPT.SHELL")
        >>>oScript.run( "cmd.exe /c ftp.exe -s:test.ftp > c:\tempfile.txt ")
        >>>
        >>>Any ideas why?
        >>>
        >>>Thanks a lot,
        >>>
        >>>Derek
        >>>
        >>>[/color]
        >>
        >>just a guess but permission to FTP.EXE?
        >>
        >>--
        >>Curt Christianson
        >>site: www.darkfalz.com
        >>blog: blog.darkfalz.c om[/color]
        >
        >
        >[/color]
        as a test, try using an admin account as your IIS user...



        --
        Curt Christianson
        site: www.darkfalz.com
        blog: blog.darkfalz.c om

        Comment

        • Derek Timothy

          #5
          Re: Problem using cmd.exe from asp

          Curt,

          I don't have the authority to change the admin account, but I think this
          problem may because the script file and the file I want to ftp are not on
          the web server itself but on a network share. I am pretty sure that the
          ISR_ANON has the access rights to the network share but something about
          permissions must be wrong.

          If I copy the ftp script to the local server then the result file is now
          created but it fails to change folder to \\server\share\ folder

          Once again it runs OK from a command line prompt.

          It must be something related to permissions but which ones?

          Thanks again.

          Best Regards,
          Derek




          "Curt_C [MVP]" <software_at_da rkfalz.com> wrote in message
          news:eCyyNkcbFH A.3844@tk2msftn gp13.phx.gbl...[color=blue]
          > Derek Timothy wrote:[color=green]
          > > Curt,
          > >
          > > It was worth a try, but sadly I get the same problem
          > >
          > > Am I adding permission to the correct account IUSR_ANON?
          > >
          > > Best Regards,
          > > Derek
          > >
          > >
          > >
          > >
          > > "Curt_C [MVP]" <software_at_da rkfalz.com> wrote in message
          > > news:%23zYcCOcb FHA.2900@TK2MSF TNGP15.phx.gbl. ..
          > >[color=darkred]
          > >>Derek Timothy wrote:
          > >>
          > >>>Hi folks I have strange problem using cmd.exe from asp code
          > >>>
          > >>>I am trying to save the results of an FTP command into a text file.[/color][/color][/color]
          When[color=blue][color=green]
          > >
          > > I
          > >[color=darkred]
          > >>>run this command from the command line of the web server it creates the[/color]
          > >
          > > text
          > >[color=darkred]
          > >>>file OK and it contains the results of the FTP commands.
          > >>>
          > >>>ftp.exe -s:test.ftp > c:\tempfile.txt
          > >>>
          > >>>However when I run it from asp using cmd.exe, it creates the file
          > >>>c:\tempfile. txt but there is nothing in it.
          > >>>
          > >>>set oScript=Server. CreateObject("W SCRIPT.SHELL")
          > >>>oScript.run( "cmd.exe /c ftp.exe -s:test.ftp > c:\tempfile.txt ")
          > >>>
          > >>>Any ideas why?
          > >>>
          > >>>Thanks a lot,
          > >>>
          > >>>Derek
          > >>>
          > >>>
          > >>
          > >>just a guess but permission to FTP.EXE?
          > >>
          > >>--
          > >>Curt Christianson
          > >>site: www.darkfalz.com
          > >>blog: blog.darkfalz.c om[/color]
          > >
          > >
          > >[/color]
          > as a test, try using an admin account as your IIS user...
          >
          >
          >
          > --
          > Curt Christianson
          > site: www.darkfalz.com
          > blog: blog.darkfalz.c om[/color]


          Comment

          Working...