Link to home
Start Free TrialLog in
Avatar of parveenmehta
parveenmehta

asked on

Using convert function in VB.NET

Experts i am writting VB.NET  code and i am trying to encryt the connection string.Following is the logic i am using but i am getting this error when i use the convert function.
Can you please quiclky help me on this.I am sure it will be a piece of cake for you.

Public Class Encryption
    Protected Friend Shared Function encryption(ByVal connectionString As String) As String
    Return Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(connectionString))
    End Function
End Class

Error::: Overload resolution failed because no accessible 'Convert' accepts this number of arguments.

Thanks

Avatar of YaakovS
YaakovS

  Maybe try doing the conversion first and then returning the value.

   You may want to post this in the VB.net section (https://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/) you can try asking a moderator to move it there, as your more likely to get useful responses there.
ASKER CERTIFIED SOLUTION
Avatar of TheSip
TheSip

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of parveenmehta

ASKER

I actually rewrote the code in C# and that solved the problem.But now i am stuck into another issue.
I am doing this conversion here
byte[] b=Convert.FromBase64String(System.Configuration.ConfigurationSettings.AppSettings["dbConString"].ToString());
Getting this error
Invalid length for a Base-64 char array
Any idea or any solutions ?
Thanks