Hi,
In web.config file we have add name and add key what is the difference b/w them?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pravin MoreRank #1,419 · 1.2K reputationPosted Nov 10, 2011, 7:41 PM EST
see there are 2 ways...
for e.g:-
1.
2.
see, in key-value we can use anything database connection or file path etc.....
where as in name-Connectionstring,i thinks it spetially for database connection.
n If you separate your connection strings into the
section, your config will be easier to read, maintain, and handle.Thanks
pravin.
Kunal Naik163 reputationPosted Nov 10, 2011, 7:37 PM EST
add name used in connectionstring tag of web.config file, it will give name of connection string while add key used in appsettings tag of web.config file, it will give name of data string.
appSettings is meant for any data string that can be stored while connectionString is meant for storing the
database connection strings only.
Datta KharadRank #2,135 · 668 reputationPosted Nov 10, 2011, 8:15 PM EST
You will have to use the "standard" way and also you can encrypt connection string.
Using add key you can not encrypt connection string, it will through error "Unrecognized attribute 'key'.."
add name used in Connectionstring tag of web.config file, it will give name of connection string while add key used in appsettings tag of web.config file.
Please mark as Accepted answer if your query resolved.