锄头清除错误“登录失败:未知用户名或密码错误“ [英] hoe to clear error " Logon failure: unknown user name or bad password "

查看:88
本文介绍了锄头清除错误“登录失败:未知用户名或密码错误“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有

如何清除错误登录失败:未知用户名或密码错误

以下编码使用错误发生如何清除错误

Dear All
How to clear error " Logon failure: unknown user name or bad password"
below coding using error occur how to clear error

private void Run()
        {
            /* Execute PSFTP as a System.Diagnostics.Process using the supplied login info and generated batch file */
            try
            {
                SecureString sec_strPassword = new SecureString();
                SecureString secureString = new SecureString();
                Misc miscObj = new Misc();
                //Converting UnSecure String to Secure String
                sec_strPassword = miscObj.convertToSecureString(_Password.Trim());
                
                ProcessStartInfo PsftpStartInfo = new ProcessStartInfo(_PsftpPath,
                _User.Trim() + @"@" + _Host.Trim() + @" -pw " + _Password.Trim() + @" -batch -be -b " + _BatchFilePath);

                /* Allows redirecting inputs/outputs of PSFTP to your app */
                PsftpStartInfo.RedirectStandardInput = true;
                PsftpStartInfo.RedirectStandardOutput = true;
                PsftpStartInfo.RedirectStandardError = true;
                PsftpStartInfo.UseShellExecute = false;
                PsftpStartInfo.Domain = _Host;
                PsftpStartInfo.UserName = _User.Trim();
                PsftpStartInfo.Password = sec_strPassword  ;
                System.Diagnostics.Process PsftpProcess = new System.Diagnostics.Process();
                PsftpProcess.StartInfo = PsftpStartInfo;
           <big>     PsftpProcess.Start();</big>

                /* Streams for capturing outputs and errors as well as taking ownership of the input */
                StreamReader PsftpOutput = PsftpProcess.StandardOutput;
                StreamReader PsftpError = PsftpProcess.StandardError;
                StreamWriter PsftpInput = PsftpProcess.StandardInput;


                while (!PsftpOutput.EndOfStream)
                {
                    try
                    {
                        /* This is usefule for commands other than 'put' or 'get' 
                         and for catching errors. */
                        Outputs += PsftpOutput.ReadLine();
                        Outputs += PsftpError.ReadLine();
                    }
                    catch (Exception ex) { Console.WriteLine(ex.ToString()); }
                }

                PsftpOutput.Close();
                PsftpError.Close();
                PsftpInput.Close();
                PsftpProcess.WaitForExit();

                PsftpStartInfo = null;
                PsftpProcess = null;
            }
            catch (Exception ex) { Console.WriteLine(ex.ToString()); }

            /* Delete the batch file */
            try
            {
                File.Delete(_BatchFilePath);
            }
            catch (Exception ex) { Console.WriteLine(ex.ToString()); }

            return;
        }

推荐答案

它与您的代码无关。您只需要确保传递正确的用户名和密码组合。
It has nothing to do with your code. You just need to make sure you pass the correct combination of user name and password.


这篇关于锄头清除错误“登录失败:未知用户名或密码错误“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆