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

démarrer un process sous un autre utilisateur (2)

1 réponse
Avatar
Nicopil
Salut =E0 tous, voil=E0 mon probl=E8me (je suis en asp.net 2):

j'utilise le code suivant au sein d'une page asp.net 2 pour d=E9marrer
un process sous un autre nom (identifiants donn=E9s dans une variable de
session:

---------------------------------------------------------------------------=
------------------------------------------------------------
System.Diagnostics.Process proc =3D new System.Diagnostics.Process();
proc.StartInfo.FileName =3D "nom_executable";

System.Security.SecureString ss =3D new System.Security.SecureString();
string pw =3D Session["passwordValue"].ToString();
foreach ( char c in pw )
{
ss.AppendChar(c);
}
proc.StartInfo.UserName =3D Session["usernameValue"].ToString();
proc.StartInfo.Password =3D ss;
proc.StartInfo.LoadUserProfile=3Dtrue;
proc.StartInfo.Domain=3D"DOMAINE_AD";
proc.StartInfo.RedirectStandardOutput =3D true;
proc.StartInfo.UseShellExecute =3D false;
proc.Start();

---------------------------------------------------------------------------=
------------------------------------------------------------


et voil=E0 ce que ca me r=E9pond :
---------------------------------------------

Server Error in '/' Application.

The handle is invalid
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.ComponentModel.Win32Exception: The handle is
invalid

Source Error:


Line 48: proc.StartInfo.RedirectStandardOutput =3D true;
Line 49: proc.StartInfo.UseShellExecute =3D false;
Line 50: proc.Start();
Line 51:
Line 52:




que faire ???

bye
Nico

1 réponse

Avatar
Patrice
Je dirais que c'est parce qu'il n'y a pas de sortie standard dans ce cas (ne
pas oublier qu'aucune session n'est ouverte). Essayer plutôt de rediriger la
sortie vers un fichier...

--
Patrice

"" a écrit dans le message de news:

Salut à tous, voilà mon problème (je suis en asp.net 2):

j'utilise le code suivant au sein d'une page asp.net 2 pour démarrer
un process sous un autre nom (identifiants donnés dans une variable de
session:

---------------------------------------------------------------------------------------------------------------------------------------
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "nom_executable";

System.Security.SecureString ss = new System.Security.SecureString();
string pw = Session["passwordValue"].ToString();
foreach ( char c in pw )
{
ss.AppendChar(c);
}
proc.StartInfo.UserName = Session["usernameValue"].ToString();
proc.StartInfo.Password = ss;
proc.StartInfo.LoadUserProfile=true;
proc.StartInfo.Domain="DOMAINE_AD";
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.Start();

---------------------------------------------------------------------------------------------------------------------------------------


et voilà ce que ca me répond :
---------------------------------------------

Server Error in '/' Application.

The handle is invalid
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.ComponentModel.Win32Exception: The handle is
invalid

Source Error:


Line 48: proc.StartInfo.RedirectStandardOutput = true;
Line 49: proc.StartInfo.UseShellExecute = false;
Line 50: proc.Start();
Line 51:
Line 52:




que faire ???

bye
Nico