5
Contributors
5
Replies
7
Views
6 Years
Discussion Span
Last Post by Fortinbra
0

web.config is used with web applications. web.config will by default have several configurations required for the web application. You can have a web.config for each folder under your web application.

app.config is used for windows applications. When you build the application in vs.net, it will be automatically renamed to <appname>.exe.config and this file has to be delivered along with your application.

You can use the same method to call the appsettings values from both config files :

System.Configuration.COnfigurationSettings.AppSettings["Key"]

0

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

0

hi...
app config-->This app settings is used for windows based application,suppose if you are creating windows based application in vb.net you have to set the database setting in app settings
web.config-->This web settings is used for web based application,suppose if you are creating web based application in asp.net you have to set the database setting in wen settings

Edited by Ezzaral: Snipped &quot;fake sig&quot; link. Please restrict such links to your site-wide user signature, which can be edited from the user control panel.

0

Don't forget that the machine.config file exists, which is your global config for .NET, most commonly referenced in ASP.NET literature, as the global settings used in IIS for ALL ASP.NET apps on that server. The only time you ever really want to alter this file is if your running on a custom web server and want to change your global .NET settings. Messing with this file is a very BAD idea.

Also, App.Config in an application is optional, it doesn't have to be used when writing desktop apps.

Web.Config is required for ASP.NET webpages

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.