Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

démarrer un process sous un autre utilisateur

1 réponse
Avatar
Nicopil
Salut, j'essaie de d=E9marrer un process sous le nom d'un autre
utilisateur, le systeme me r=E9pond :

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


Pourquoi ? Est ce que la propri=E9t=E9 UserName du ProcessStartInfo'
n'existe vraiment pas ?

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

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

string passwordEnClair=3DSession["passwordValue"].ToString();
System.Security.SecureString ChaineSecurisee=3Dnew
System.Security.SecureString();
for(int i=3D0;i<passwordEnClair.Length;i++)
{
ChaineSecurisee.AppendChar(passwordEnClair[i]);
}
proc.StartInfo.Password=3DChaineSecurisee;



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




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


aidez moi svp !

1 réponse

Avatar
Gilles TOURREAU
Le Mon, 22 Oct 2007 15:39:50 +0200, a
é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<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 !




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