Click here to Skip to main content
15,742,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I have search the net on how can I encrypt my App.config that I created in VB Winform.

I found this article on this site


What I`m expecting is that when I view the App.Config file in the Application Folder I should not be able to view the Database user and Password but, it does not seems to be working.

Here is my App Config Code.

                  Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="EncrpytOracle_Connection"
               type="System.Configuration.ClientSettingsSection, System,
                    Version=, Culture=neutral, PublicKeyToken=b77a561934e089"

    <add name="Oracle_Connection" connectionString="Driver=Microsoft ODBC for Oracle;uid=SOMEID;pwd=SOMEPWD;server=SOMEDB"/>
            <!-- This section defines the logging configuration for My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
                    <add name="FileLog"/>
                    <!-- Uncomment the below section to write to the Application Event Log -->
                    <!--<add name="EventLog"/>-->
            <add name="DefaultSwitch" value="Information" />
            <add name="FileLog"
                 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" 
            <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->

As you can see in my connection string DB user Name, Password and Server is visible.

How do I encrypt it?

Please also check the my Class for decryption.

<pre lang="Imports System.Configuration<br mode=" hold=" /><br mode=" configurationsection=")<br mode=">

This is actually my 1st time to use app config encryption.

Can someone kindly give me an advice.

Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900