我发现如果使用以下典型代码启动进程,并且用户的登录信息以任何方式不正确,应用程序将挂起(即使使用try / catch)而不是报告错误:< / p>
' Start the process
Dim ExecuteCommand As New ProcessStartInfo
ExecuteCommand.FileName = strCommandLine
ExecuteCommand.Arguments = strCommandLineArgs
ExecuteCommand.Domain = strDomainName
ExecuteCommand.UserName = strDomainAdmin
ExecuteCommand.Password = strDomainAdminPW ' SecureString password
ExecuteCommand.UseShellExecute = False
ExecuteCommand.WindowStyle = ProcessWindowStyle.Hidden
System.Diagnostics.Process.Start(ExecuteCommand)
如果用户没有搞砸他的凭据,代码就会很好用。但是,如果身份验证失败,我需要通知用户。但是,我似乎无法解决这个问题,应用程序只是像某种神秘的循环一样挂起来锁定应用程序。
一个应用程序因为用户输入密码错误而崩溃是荒谬的,但我无法在网上找到有关此问题的任何内容。
非常感谢所有的大师,顺便说一下。我几乎不必在这里提问,因为你们提供了如此多的救命和专家帮助。
注意:使用VB.NET 2010