• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6224
  • Last Modified:

how to assign a password as system.security.secureString VB.NET 2.0

I want to open a file using a password with process start.  The password is "pass+word".  How can I convert the password to type system.security.secure string?

Dim sFile = "\\server\servdir\somefile.pdf"
Dim sUser As String = "user"
Dim sPass As String = "pass+word"
Dim SDomain As String = "XYZ"
'newPass = New System.Security.SecureString() ???????
Process.Start(sFile, sUser, newPass, SDomain)

Open in new window

1 Solution
Joel CoehoornDirector of Information TechnologyCommented:
I haven't worked with secure string, but maybe try this:

Dim newPass as New Security.SecureString()
For Each c As Char In sPass
Next c

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now