GNT sans publicité, site mobile, fonctionnalitées exclusives...

démarrer un process sous un autre utilisateur

Le
Nicopil
Salut, j'essaie de démarrer un process sous le nom d'un autre
utilisateur, le systeme me répond :

Compiler Error Message: CS0117: 'System.Diagnostics.ProcessStartInfo'
does not contain a definition for 'UserName'


Pourquoi ? Est ce que la propriété UserName du ProcessStartInfo'
n'existe vraiment pas ?

mon code :

string executable="WebFindPrinterQueue.ps1";

string arguments=parametres.Text;
System.Diagnostics.Process proc = new
System.Diagnostics.Process();
proc.StartInfo.UserName = Session["usernameValue"].ToString();

string passwordEnClair=Session["passwordValue"].ToString();
System.Security.SecureString ChaineSecurisee=new
System.Security.SecureString();
for(int i=0;i<passwordEnClair.Length;i++)
{
ChaineSecurisee.AppendChar(passwordEnClair[i]);
}
proc.StartInfo.Password=ChaineSecurisee;



proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.Start();




mon erreur :
--
Line 17: string arguments=parametres.Text;
Line 18: System.Diagnostics.Process proc = new
System.Diagnostics.Process();
Line 19: proc.StartInfo.UserName =
Session["usernameValue"].ToString(); <<-- ERREUR
Line 20:
Line 21: string passwordEnClair=Session["passwordValue"].ToString();


aidez moi svp !
Lire la réponse

Vidéos High-Tech et Jeu Vidéo
Téléchargements
Vos réponses
Gagnez chaque mois un abonnement Premium avec GNT : Inscrivez-vous !
Trier par : date / pertinence
Gilles TOURREAU
Le #12169801
Le Mon, 22 Oct 2007 15:39:50 +0200, écrit:

Salut, j'essaie de démarrer un process sous le nom d'un autre
utilisateur, le systeme me répond :

Compiler Error Message: CS0117: 'System.Diagnostics.ProcessStartInfo'
does not contain a definition for 'UserName'


Pourquoi ? Est ce que la propriété UserName du ProcessStartInfo'
n'existe vraiment pas ?

mon code :
---------------
string executable="WebFindPrinterQueue.ps1";

string arguments=parametres.Text;
System.Diagnostics.Process proc = new
System.Diagnostics.Process();
proc.StartInfo.UserName = Session["usernameValue"].ToString();

string passwordEnClair=Session["passwordValue"].ToString();
System.Security.SecureString ChaineSecurisee=new
System.Security.SecureString();
for(int i=0;i {
ChaineSecurisee.AppendChar(passwordEnClair[i]);
}
proc.StartInfo.Password=ChaineSecurisee;



proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.Start();




mon erreur :
-----------------
Line 17: string arguments=parametres.Text;
Line 18: System.Diagnostics.Process proc = new
System.Diagnostics.Process();
Line 19: proc.StartInfo.UserName > Session["usernameValue"].ToString(); <<-- ERREUR
Line 20:
Line 21: string passwordEnClair=Session["passwordValue"].ToString();


aidez moi svp !




Certainement que Session["usernameValue"] doit renvoyer null...

Déboguer votre code pour voir d'où vient l'erreur...

Cordialement

--
Gilles TOURREAU


S.A.R.L. P.O.S
Le spécialiste en motoculture depuis + de 30 ans !
http://www.pos.fr
Publicité
Suivre les réponses
Poster une réponse
Anonyme