Can someone please help? I am trying to convert a program from VB to C# and I am struggling to convert the following.
Dim
WinRoot As String ' Root of Windows Directory
Const ToolRoot = "\\dfw30805\data\OMC_Apps\OMC_Common\" ' Root for Tools Directory
' Function Procedure to convert password into SecureString
Function ConvertToSecureString(ByVal str As String)
Dim password As New SecureString
For Each c As Char In Str.ToCharArray
password.AppendChar(c)
Next
Return password
End Function
And I also need the following code converted also.
Dim
LDAPString As String
Dim ContextName
Try
LDAPString =
"LDAP://CN=" & Environ$("username") & ",OU=users,OU=510001,OU=OMC_Pilot,OU=Projects,DC=link4,DC=gpn,DC=gov,DC=uk"
'MsgBox(LDAPString)
ContextName = GetObject(LDAPString)
LabContext.Text = ContextName.FirstName &
" " & ContextName.LastName & " on " & Environ$("computername")
Catch
LabContext.Text =
"User : " & Environ$("username") & " on " & Environ$("computername")
End Try
I would very much appreciate any help I can get.
Best regards
Andrew