Why have the difference between web.config and app.config

A

ad

When I add a connection string by wizard in a WebApp , the wizard add the
connection string to web.config like
<add name="MyDataBase" connectionString="Data Source=.\SQLEXPRESS;Initial
Catalog=xxxx;.....

But if I add the same connection string by wizard in a class library
project, the connection string in app.config will be:
<add name="dataHealth.Properties.Settings.MyDataBase"
connectionString="Data Source=.\SLEEPERS;Initial Catalog=xxxx...

The connection string name in app.config will be initial with
"ProjectName..Properties.Settings"
Why have the difference between web.config and app.config
 
C

Christopher Reed

For a web application, you would use web.config. For either an EXE or class
library DLL, you would use the "app".config. The difference with the
connection string name is so that you can maintain uniqueness among multiple
config files. Also, the web.config can be accessed from either
System.Configuration.ConfigurationManager or
System.Web.Configuration.WebConfigurationManager.

I'm not sure if this is what you're looking for.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top