Running Shell applications from .NET Windows application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?R3JlZw==?=

    #1

    Running Shell applications from .NET Windows application

    I am trying to create a VB .NET 2003 Windows application to ftp files to a
    server and then open a telnet session on a AIX box to run a remote command
    based on parameters from the application form. What is the best way to do
    this?

    I prefer to not to use FTP files because I do not want to save the password
    in a file for security reasons.

    I tried to invoke a cmd.com session in a process and redirect standard I/I,
    but I can't read all of the ftp input for some reason.

    Dim strSysFolder As String =
    Environment.Get FolderPath(Envi ronment.Special Folder.System)
    Dim psi As New ProcessStartInf o
    psi.FileName = "cmd"
    psi.UseShellExe cute = False
    psi.RedirectSta ndardOutput = True
    psi.RedirectSta ndardInput = True

    Dim p As Process = Process.Start(p si)
    Dim iosr As IO.StreamReader = p.StandardOutpu t
    Dim iosw As IO.StreamWriter = p.StandardInput

    iosw.Readline(s trLine)
    iosw.WriteLine( "ftp server")
    iosw.Readline(s trLine)
    iosw.WriteLine( "user id")
    iosw.Readline(s trLine)

    but the text is not always returned from FTP.

    Or would using Windows Script Host Object Model be better? Such as

    Dim wsc As New IWshRuntimeLibr ary.WshShellCla ss
    wsc.Run("cmd")

    But how do you get at the output?

  • Spam Catcher

    #2
    Re: Running Shell applications from .NET Windows application

    =?Utf-8?B?R3JlZw==?= <Greg@discussio ns.microsoft.co mwrote in
    news:C97C731B-8BE6-4961-B8C9-09870D1EEE56@mi crosoft.com:
    I am trying to create a VB .NET 2003 Windows application to ftp files
    to a server and then open a telnet session on a AIX box to run a
    remote command based on parameters from the application form. What is
    the best way to do this?
    There are a bunch of FTP components available (some free).





    etc.
    etc.

    Otherwise .NET 2.0 has a FTP class built in.

    Comment

    • =?Utf-8?B?R3JlZw==?=

      #3
      Re: Running Shell applications from .NET Windows application

      I don't want to use third party applications. Any other way?

      "Spam Catcher" wrote:
      =?Utf-8?B?R3JlZw==?= <Greg@discussio ns.microsoft.co mwrote in
      news:C97C731B-8BE6-4961-B8C9-09870D1EEE56@mi crosoft.com:
      >
      I am trying to create a VB .NET 2003 Windows application to ftp files
      to a server and then open a telnet session on a AIX box to run a
      remote command based on parameters from the application form. What is
      the best way to do this?
      >
      There are a bunch of FTP components available (some free).
      >

      >

      >
      etc.
      etc.
      >
      Otherwise .NET 2.0 has a FTP class built in.
      >
      >

      Comment

      • Spam Catcher

        #4
        Re: Running Shell applications from .NET Windows application

        =?Utf-8?B?R3JlZw==?= <Greg@discussio ns.microsoft.co mwrote in
        news:C75E122A-262A-414A-9AC4-A36151740C3F@mi crosoft.com:
        I don't want to use third party applications. Any other way?
        It's not really an application, it's a DLL library which you use in your
        program.

        If you want to use something built in, .NET 2.0 is the way to go.

        Comment

        • =?Utf-8?B?R3JlZw==?=

          #5
          Re: Running Shell applications from .NET Windows application

          I see there is FTP support for .NET 2.0, but is there telnet support for .NET
          2.0?

          And the FTP support can be used with Windows Applications as opposed to
          ASP.NET applications?

          "Spam Catcher" wrote:
          =?Utf-8?B?R3JlZw==?= <Greg@discussio ns.microsoft.co mwrote in
          news:C75E122A-262A-414A-9AC4-A36151740C3F@mi crosoft.com:
          >
          I don't want to use third party applications. Any other way?
          >
          It's not really an application, it's a DLL library which you use in your
          program.
          >
          If you want to use something built in, .NET 2.0 is the way to go.
          >
          >

          Comment

          • Spam Catcher

            #6
            Re: Running Shell applications from .NET Windows application

            =?Utf-8?B?R3JlZw==?= <Greg@discussio ns.microsoft.co mwrote in
            news:034C2F76-B1BB-4232-81E5-3B574B0D46E3@mi crosoft.com:
            I see there is FTP support for .NET 2.0, but is there telnet support
            for .NET 2.0?
            Yes, the standard TCPClient or Socket classes will do fine for Telnet.

            However, the built in implementation is pretty bare bones ... so you might
            to seriously reconsider and look at using a 3rd party library (nSoftware
            IPWorks for example).
            And the FTP support can be used with Windows Applications as opposed
            to ASP.NET applications?
            Yes, the .NET classes will run in ASP.NET, WinForms, Services, whereever.
            There are caveats of course, for example, ASP.NET is stateless, you'll need
            to maintain the connection state somewhere.

            Comment

            • Jay Parzych

              #7
              Re: Running Shell applications from .NET Windows application

              edtFTPnet/Free is an open-source .NET FTP library (LGPL) with active and passive modes, binary and ASCII transfers, and resumable transfers.

              =?Utf-8?B?R3JlZw==?= <Greg@discussio ns.microsoft.co mwrote in
              news:034C2F76-B1BB-4232-81E5-3B574B0D46E3@mi crosoft.com:
              >
              >I see there is FTP support for .NET 2.0, but is there telnet support
              >for .NET 2.0?
              >>
              Yes, the standard TCPClient or Socket classes will do fine for Telnet.
              >
              However, the built in implementation is pretty bare bones ... so you
              might to seriously reconsider and look at using a 3rd party library
              (nSoftware IPWorks for example).
              >
              >And the FTP support can be used with Windows Applications as opposed
              >to ASP.NET applications?
              >>
              Yes, the .NET classes will run in ASP.NET, WinForms, Services,
              whereever. There are caveats of course, for example, ASP.NET is
              stateless, you'll need to maintain the connection state somewhere.
              >

              Comment

              Working...