3
Hello! I need to open a certain file located in a folder sharing done through Samba Server on Ubuntu Webmin. The code below seems functional, but I get the error code: Incorrect user or password.
Process proc = new Process();
proc.StartInfo = new ProcessStartInfo("\\\\192.168.10.116\\MarcaBus\\Arquivos\\Comprovantes\\arquivo.pdf");
proc.StartInfo.UserName = "root";
proc.StartInfo.Domain = "MYDOMAIN";
string PwString = "Pmjm2018!@#";
char[] PasswordChars = PwString.ToCharArray();
SecureString Password = new SecureString();
foreach (char c in PasswordChars)
Password.AppendChar(c);
proc.StartInfo.Password = Password;
proc.StartInfo.UseShellExecute = false;
proc.Start();
How do I get around this situation?
Set a limit for the password in the char[10] statement. It can have a space character, or something summing up to zero without being null. Use Passwordchars.Length to count how many characters you have to make sure the password doesn’t have something else you haven’t set.
– Wanderson Rodrigo
Instead of using you can use @ before path. Like this: Processstartinfo(@" 192.168.10.116...). @ is used to ignore possible escape characters.
– Wanderson Rodrigo
Something about using Startinfo: https://docs.microsoft.com/pt-br/dotnet/api/system.diagnostics.process.startinfo?view=netframework-4.7.2
– Wanderson Rodrigo