Re: .bat from asp.net w/System.Diagnostics.Process?
From: Alvin Bruney [MVP] (vapor)
Date: 04/12/04
- Next message: alex: "Re: Page_Load"
- Previous message: Alvin Bruney [MVP]: "Re: DataList handle"
- In reply to: danl_at_drawnet_no_spam.com: "Re: .bat from asp.net w/System.Diagnostics.Process?"
- Next in thread: danl_at_drawnet_no_spam.com: "Re: .bat from asp.net w/System.Diagnostics.Process?"
- Reply: danl_at_drawnet_no_spam.com: "Re: .bat from asp.net w/System.Diagnostics.Process?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 11 Apr 2004 23:21:13 -0500
Great, so here is where you start. After each line in your script, echo it
to the screen. Then run the app. Just follow the screen output to find which
line is failing.
-- Regards, Alvin Bruney [ASP.NET MVP] Got tidbits? Get it here... http://tinyurl.com/27cok <danl@drawnet_no_spam.com> wrote in message news:E78DD3A6-E09C-4498-ABF2-3BE502BC75EB@microsoft.com... > The results of the script from the command prompt when run from an .aspx > are > ==================== > > Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 > Microsoft > > Corp. C:\WINDOWS\system32>ftp -s:c:\ftp_scripts\ftp.txt >>> > c:\ftp_scripts\dbftplog.txt C:\WINDOWS\system32> > ==================== > The ftp call syntax that I am using allows you to have a text file with > all of your ftp connection info in it. The contents of the > c:\ftp_scripts\ftp.txt file is > =================== > open 11.22.33.44 > uname > pword > cd mydir > put "C:\SQLData\MSSQL\BACKUP\test.txt" > quit > =================== > > I'd really like to figure out why my code won't run from a web page, but I > really just need to be able to ftp from an .aspx page. If you know of a > better way, I'm open to anything that works. > > Thanks for your help. > -Dan > > > ----- Alvin Bruney [MVP] wrote: ----- > > what is the results of the script from the command prompt when you run > using > a webpage? > i'm not familiar with the syntax of the ftp command you are using. > from the > docs, ftp takes a verb followed by command line options. Post your > script > code if you still have problems. > > -- > Regards, > Alvin Bruney [ASP.NET MVP] > Got tidbits? Get it here... > http://tinyurl.com/27cok > <danl@drawnet_no_spam.com> wrote in message > news:58DDAD5C-C363-473A-AEDE-EEF9B98CD855@microsoft.com... > > Thanks for your help Alvin, but I still can't get the sript to run. > I > > tried to simplify the code by executing the command that was in the > bat > > file directly from this script, still no luck. > >> The cmd simply takes a file and ftp's it to another server. the > output is > > recorded in a log file. If I execute the cmd from the cmd line, it > works > > fine (the file is moved, and there is an entry in the log file). > >> When I execute it with the following script from an .aspx, no file > moved > > and no log entry. > >> I'm stumped!! Any other idea's why this might not be working? > >> ======================================= > > System.Diagnostics.Process p = new Process(); > > p.StartInfo.RedirectStandardOutput=true; > > p.StartInfo.RedirectStandardInput=true; > > p.StartInfo.FileName = @"cmd"; > > p.StartInfo.UseShellExecute=false; > > p.Start(); > > StreamWriter sIn = p.StandardInput; > > sIn.AutoFlush = true; > > StreamReader sOut = p.StandardOutput; > >> sIn.Write(@"ftp -s:c:\ftp_scripts\ftp.txt >> > c:\ftp_scripts\ftp_log.txt" + > > System.Environment.NewLine); > > sIn.Close(); > >> string results = sOut.ReadToEnd().Trim(); > > p.Close(); > >> Response.Write(results); > > =========================================== > >> OUTPUT > > =========================================== > > Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 > Microsoft > > Corp. C:\WINDOWS\system32>ftp -s:c:\ftp_scripts\ftp.txt >>> > c:\ftp_scripts\dbftplog.txt C:\WINDOWS\system32>> > =========================================== > > >
- Next message: alex: "Re: Page_Load"
- Previous message: Alvin Bruney [MVP]: "Re: DataList handle"
- In reply to: danl_at_drawnet_no_spam.com: "Re: .bat from asp.net w/System.Diagnostics.Process?"
- Next in thread: danl_at_drawnet_no_spam.com: "Re: .bat from asp.net w/System.Diagnostics.Process?"
- Reply: danl_at_drawnet_no_spam.com: "Re: .bat from asp.net w/System.Diagnostics.Process?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|