> To store the
connection strings at a place, configuration files are used in .net application.
> We use web.config
file for web application and app.config file for windows application.
WEB.CONFIG:-
•
It’s a
configuration file for web application.
•
This file is
used to store the connection string which contains the code for the connectivity
with the data source.
•
This file is
added by default if we are developing ASP.NET web application.
•
The extension of
a configuration file is .config.
•
A configuration
file can store multiple connectionStrings.
APP.CONFIG:-
•
It’s a configuration
file for windows application.
•
This file is also used to store the connection strings which contains the code for the
connectivity with the data source.
•
This file has to
be added explicitly as it is not added by default.
•
The extension of this configuration file is .config.
•
A configuration
file can store multiple connectionStrings.
•
To add it in the
application:
> Open project in visual studio.
> Go to solution explorer.
> Right click on the project name.
> Click on the new item option.
> Select the application configuration file from the dialog box.
> Specify name of file(by default it is app.config).
> Click add button.
> File is now added to the project.
Comments
Post a Comment