Running Shell applications from .NET Windows application

G

Guest

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.GetFolderPath(Environment.SpecialFolder.System)
Dim psi As New ProcessStartInfo
psi.FileName = "cmd"
psi.UseShellExecute = False
psi.RedirectStandardOutput = True
psi.RedirectStandardInput = True

Dim p As Process = Process.Start(psi)
Dim iosr As IO.StreamReader = p.StandardOutput
Dim iosw As IO.StreamWriter = p.StandardInput

iosw.Readline(strLine)
iosw.WriteLine("ftp server")
iosw.Readline(strLine)
iosw.WriteLine("user id")
iosw.Readline(strLine)

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 IWshRuntimeLibrary.WshShellClass
wsc.Run("cmd")

But how do you get at the output?
 
G

Guest

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.
 
G

Guest

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?
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top