Bonjour,

J'ai une fonction qui doit envoyer sur un ftp exterieur un fichier.
Pour cela j'ai créé un scripttxt qui contient les commandes ftp pour l'upload de mon fichier sur le ftp. Ce script fonctionne parfaitement sous DOS.

Dans mon programme C# je fait appel a ce script pour envoyer mon fichier. Cela marche en mode debug et release, mais si je lance l'executable se trouve dans MonProjet\bin\debug\MonAppli.exe rien ne se passe. Le fichier n'est pas uploader et je n'arrive a retourner les informations de sortie de DOS alors que sa marche directement a travers Visual Studio 2008.

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo("cmd.exe", "/c ftp -v -i -s:" + System.Windows.Forms.Application.StartupPath + @"\test.txt");
 
startInfo.CreateNoWindow = true;
startInfoPro.UseShellExecute = false;
 
System.Diagnostics.Process proc =System.Diagnostics.Process.Start(startInfo);
 
proc.Start();
string str = proc.StandardError.ReadToEnd();
MessageBox.Show(str);
 
proc.WaitForExit();
proc.Dispose();
proc = null;

Pouvez vous m'aider la dessus ?

Merci