0

web.config

  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="ServerName" value="localhost" />
    <add key="DatabaseName" value="amc_live" />    
    <!--<add key="PwdName" value="123456" />-->
    <add key="LogError" value="1" />
  </appSettings>


  <secureAppSettings>
    <add key="UserName" value="root" />
    <add key="Password" value="12345" />
  </secureAppSettings>

I am not getting how to get values of user name and password in securityAppSettings and how to update these..

Can anyone help me in this?

Thanks

jegtugado
  • 5,081
  • 1
  • 12
  • 35
Surya
  • 265
  • 1
  • 3
  • 10
  • 1
    Possible duplicate of [How to read values from custom section in web.config](https://stackoverflow.com/questions/6329114/how-to-read-values-from-custom-section-in-web-config) – jegtugado Nov 03 '17 at 06:23
  • and/or [Editing Web.config programmatically](https://stackoverflow.com/questions/270287/editing-web-config-programmatically) – jegtugado Nov 03 '17 at 06:28
  • Thanks john, i can able to access data... but that edit web.config it will update to only appsetting but i need to update username and password which is in securityAppSettings – Surya Nov 03 '17 at 06:35
  • Using the same technique in the 2nd link. See [C# - Saving Custom Configuration](https://stackoverflow.com/a/11992353/6138713). – jegtugado Nov 03 '17 at 06:42
  • Thanks john, I got the solution!!! – Surya Nov 03 '17 at 06:52
  • Hey how can i get this username and password values and assign it to global variables.... am not able to assign to global variable – Surya Nov 06 '17 at 11:43

0 Answers0