Using convert function in VB.NET

Posted on 2006-05-23
Last Modified: 2012-06-27
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.


Question by:parveenmehta
    LVL 5

    Expert Comment

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

       You may want to post this in the section ( you can try asking a moderator to move it there, as your more likely to get useful responses there.

    Accepted Solution

    your stuck in an infinite loop

    Author Comment

    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 ?

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Can't write to Printer in Procomm V4.8 8 75
    PDF File Shrinker 10 71
    Driver Problem 12 50
    Image Deployment Tool 9 43
    This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
    A list of useful business intelligence software.
    The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
    The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now