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.ToCharArraypassword.AppendChar(c)
Next Return password End FunctionAnd I also need the following code converted also.
Dim
LDAPString As String Dim ContextName TryLDAPString =
"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") CatchLabContext.Text =
"User : " & Environ$("username") & " on " & Environ$("computername") End TryI would very much appreciate any help I can get.
Best regards
Andrew
Andrew MartinPosted Sep 15, 2008, 2:22 PM
Ryan AlfordPosted Sep 12, 2008, 11:39 AM
const string ToolRoot = @"\\dfw30805\data\OMC_Apps\OMC_Common\";
private SecureString ConvertToSecureString(string str)
{
private SecureString password = new SecureString();
foreach (char c in str.ToCharArray())
{
password.Append(c);
}
return password
}