使用ConvertToSecureString显示错误“用户名或密码不正确” [英] Use ConvertToSecureString show error "The user name or password is incorrect"
本文介绍了使用ConvertToSecureString显示错误“用户名或密码不正确”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法打开网络上共享的文件夹。显示错误用户名或密码不正确请帮助新手
我使用下面的代码
I cannot open folder shared on network. Show error "The user name or password is incorrect" please help newbie
I use code as below
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim username As String = "lin"
Dim password As SecureString = ConvertToSecureString("a")
Dim domain As String = Nothing
Try
Process.Start("\\10.231.2.98", "explorer.exe", username, password, domain)
Catch ex As Win32Exception
MessageBox.Show(ex.ToString)
MessageBox.Show("Wrong username or password.", _
"Error logging in as administrator", MessageBoxButtons.OK, _
MessageBoxIcon.Error)
End Try
End Sub
Function ConvertToSecureString(ByVal str As String) As SecureString
Dim password As New SecureString
For Each c As Char In str.ToCharArray
password.AppendChar(c)
Next
Return password
End Function
请帮帮我TT
Help me please T T
推荐答案
尝试使用starti nfo
例子
Try to use startinfo
Example
Dim startInfo As New ProcessStartInfo("IExplore.exe")
startInfo.WindowStyle = ProcessWindowStyle.Minimized
startInfo.Arguments = "http:....."
startInfo.UserName = ""
startInfo.Password = ConvertToSecureString("a")
Process.Start(startInfo)
这篇关于使用ConvertToSecureString显示错误“用户名或密码不正确”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文