[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6151
  • 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

0
stevep01
Asked:
stevep01
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
    newPass.AppendChar(c)
Next c

Open in new window

1

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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