asp.net - Encrypted config file does not apply “remove” tag in connectionStrings -


based on duplicate connection string error question have added remove tag before adding connectionstring. resolved problem original question.

but, when applied rsa encryption web.config file (using aspnet_regiis) error came back.

parser error message: entry 'theconnectionstring' has been added.

i think, when encrypted, not calling ‘remove’ statement. so? workaround issue?

original connectionstring

<connectionstrings>  <remove name="theconnectionstring" />  <add name="theconnectionstring" ... /> <connectionstrings> 

encrypted config

enter image description here

by using clear instead of remove first statement in connectionstrings section, resolve problem.

note: clear retained after manually decrypted config file. remove not retained after encryption-decryption. [thanks @oded giving comment check this]

refer connection strings , configuration files

the machine.config file contains connectionstrings section, contains connection strings used visual studio. when retrieving connection strings provider name app.config file in windows application, connection strings in machine.config loaded first, , entries app.config. adding clear after connectionstrings element removes inherited references data structure in memory, connection strings defined in local app.config file considered.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -