Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7420775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:17:46+00:00 2026-05-29T08:17:46+00:00

I am using following code to replace the passwords in my app.config. It replaces

  • 0

I am using following code to replace the passwords in my app.config. It replaces successfully but does not reload config file in the memory so datasets give error of wrong password.
Please help

 Dim vrTextFind As String = "Password"
    Dim vrTextReplaceWith As String = "PWD"
    Dim path As String = "D:\VS2008\EncTest\EncTest\bin\Debug\enctest.exe.config"
    Dim readText As String = File.ReadAllText(path)
    TextBox1.Text = readText
    'Find
    Dim idx As Integer = 0
    idx = TextBox1.Text.IndexOf(vrTextFind, idx)
    If idx = -1 Then
        MessageBox.Show(vrTextFind & " is not in Textbox1")
    Else
        TextBox1.SelectionStart = idx
        TextBox1.SelectionLength = vrTextFind.Length
    End If
    'Replace
    If TextBox1.Text.Contains(TextBox1.Text) Then
        TextBox1.Text = TextBox1.Text.Replace(vrTextFind, vrTextReplaceWith)
    Else
        MessageBox.Show(TextBox1.Text & " is not in Textbox3")
    End If
    '''''
    'Write all back
    File.WriteAllText(path, TextBox1.Text)
    'Refreshes the connection string section
    ConfigurationManager.RefreshSection("connectionStrings")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:17:47+00:00Added an answer on May 29, 2026 at 8:17 am

    In windows application app.config is read only once, when the application starts. If you modify it you will need to restart the app.

    Suggestion

    Instead of storing password in app.config store it in some other file (like Settings file). Which can be modified and read at runtime. For Settings you can read on MSDN. And choose User-Scope settings.

    Hope this helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to remove a file from path using following code. But my
I'm using following code but cannot return data from MySQL. This is the output:
I am using following code. When the query crashes, it is not displaying the
I am currently using the following JavaScript code: concatedSubstring.replace(/\//g, '-').replace(/[A-Za-z]/g, function(c){ return c.toUpperCase().charCodeAt(0)-64; });
I am trying to define a type using the following code. CREATE OR REPLACE
I'm using the following code for fetching a latest tweet but I would like
How do I replace using the following code? ereg_replace(%Data_Index\[.\]%, $this->resultGData[$key ][\\1], $var) I want
I am using following code to replace title bar. final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_NO_TITLE);
I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,
I am using following code to check whether a check box on my website

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.