It is an optional XML File which stores configuration details for a specific asp.net web application.
Note:When you modify the settings in the
Web.Config file, you do not need to restart the Web service for the modifications to take effect..By default, the Web.Config file applies to all the pages in the current directory and its subdirectories.
Extra: You can use the <location> tag to lock configuration settings in the
Web.Config file so that they cannot be overridden by a
Web.Config file located below it. You can use the
allowOverride attribute to lock configuration settings. This attribute is especially valuable if you are hosting untrusted applications on your server.
As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected
on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.
You can override settings in the Machine.Config file for all the applications in a particular Web site by placing a Web.Config file in the root directory of the Web site as follows:
There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file..
Can I use IIS as an alternative way of configuring Custom error pages?
Yes, you can. But the preferable way would be ASP.NET, as the ASP.NET custom pages are configured in XML based web.config (application configuration) file, resulting in easy (xcopy) deployment and management.
Configuration files are arranged in hierarchy.Child Web.Config files override configuration settings specified by their parents. This means that you do not need to copy the complete contents of a parent
Web.Config file when creating a Web.Config lower in the hierarchy. You can specify only the configuration settings that you need to modify.
Note:If your asp.net application doesn’t consist of Web.Config file than all the settings from machine.config file would be applied.
Difference between Web.Config and Machine.Config File
Two types of configuration files supported by ASP.Net.
Configuration files are used to control and manage the behavior of a web application.
i) Machine.config
ii)Web.config
Difference between Machine.Config and Web.Config Machine.Config: i) This is automatically installed when you install Visual Studio. Net.
ii) This is also called machine level configuration file.
iii)Only one machine.config file exists on a server.
iv) This file is at the highest level in the configuration hierarchy.
Web.Config: i) This is automatically created when you create an ASP.Net web application project.
ii) This is also called application level configuration file.
iii)This file inherits setting from the machine.config
[:D]Web config is an xml file . By using this file we can set application level settings where as Machine config file is also an xml file where we can do machine level settings. so , by using web config file we can do settings which is limited to particular
application and if u do settings using machine config file it is applied to all applications.
dotnetguts
Member
206 Points
95 Posts
Configuration Files FAQs (web.config, machine.config...)
Jun 03, 2007 11:35 AM|LINK
What is Web.Config File?
It is an optional XML File which stores configuration details for a specific asp.net web application.
Note: When you modify the settings in the Web.Config file, you do not need to restart the Web service for the modifications to take effect.. By default, the Web.Config file applies to all the pages in the current directory and its subdirectories.
Extra: You can use the <location> tag to lock configuration settings in the Web.Config file so that they cannot be overridden by a Web.Config file located below it. You can use the allowOverride attribute to lock configuration settings. This attribute is especially valuable if you are hosting untrusted applications on your server.
FAQ collected from http://dng-config.blogspot.com/
What is Machine.config File?
The Machine.Config file, which specifies the settings that are global to a particular machine. This file is located at the following path:
\WINNT\Microsoft.NET\Framework\[Framework Version]\CONFIG\machine.config
As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.
You can override settings in the Machine.Config file for all the applications in a particular Web site by placing a Web.Config file in the root directory of the Web site as follows:
\InetPub\wwwroot\Web.Config
FAQ collected from http://dng-config.blogspot.com/
What can be stored in Web.config file?
There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file..
1. Database connections.
2. Session States
3. Error Handling (CustomError Page Settings.)
4. Security (Authentication modes)
FAQ collected from http://dng-config.blogspot.com/
What is the best place to store Database connection string?
In Web.Config, you would add a key to the AppSettings Section:
<appSettings>
<add key="MyDBConnection" value="data source=<ServerName>;Initial catalog =<DBName>;user id=<Username>;password=<Password>;" />
</appSettings>
Example:
<add key="ConnectionString" value= "data source=localhost;Initial catalog=northwind;user id=sa;password=mypass" />
Then, in your ASP.Net application - just refer to it like this:
using System.Configuration;
string connectionString = (string )ConfigurationSettings.AppSettings["ConnectionString"];
Can I use IIS as an alternative way of configuring Custom error pages?
Yes, you can. But the preferable way would be ASP.NET, as the ASP.NET custom pages are configured in XML based web.config (application configuration) file, resulting in easy (xcopy) deployment and management.
FAQ collected from http://dng-config.blogspot.com/
Hierarchy of Configuration File
Configuration files are arranged in hierarchy. Child Web.Config files override configuration settings specified by their parents. This means that you do not need to copy the complete contents of a parent Web.Config file when creating a Web.Config lower in the hierarchy. You can specify only the configuration settings that you need to modify.
Note: If your asp.net application doesn’t consist of Web.Config file than all the settings from machine.config file would be applied.
FAQ collected from http://dng-config.blogspot.com/
Difference between Web.Config and Machine.Config File
Two types of configuration files supported by ASP.Net.
Configuration files are used to control and manage the behavior of a web application.
i) Machine.config
ii)Web.config
Difference between Machine.Config and Web.Config
Machine.Config:
i) This is automatically installed when you install Visual Studio. Net.
ii) This is also called machine level configuration file.
iii)Only one machine.config file exists on a server.
iv) This file is at the highest level in the configuration hierarchy.
Web.Config:
i) This is automatically created when you create an ASP.Net web application project.
ii) This is also called application level configuration file.
iii)This file inherits setting from the machine.config
Collect Most Updated FAQs @ http://dng-config.blogspot.com/
Asp.Net 1.1 asp.net 2.0 asp.net .Net FAQ Links Daily Free Code
http://dotnetguts.blogspot.com
Logon to Sharepoint Forums
tvijaybhanu@...
Member
4 Points
2 Posts
Re: Configuration Files FAQs (web.config, machine.config...)
May 14, 2008 08:44 AM|LINK
[:D]Web config is an xml file . By using this file we can set application level settings where as Machine config file is also an xml file where we can do machine level settings. so , by using web config file we can do settings which is limited to particular application and if u do settings using machine config file it is applied to all applications.
talktoarvind
Member
12 Points
9 Posts
Re: Configuration Files FAQs (web.config, machine.config...)
May 12, 2009 01:02 PM|LINK
altafkhatri@...
Member
16 Points
10 Posts
Re: Configuration Files FAQs (web.config, machine.config...)
Nov 17, 2011 11:22 PM|LINK
And if you ever run into issue where your machine.config values are not getting picked up then have a look at this article:
Why machine.config values are not getting picked up?
Pekanbaru
Member
4 Points
4 Posts
Re: Configuration Files FAQs (web.config, machine.config...)
Nov 29, 2011 04:51 PM|LINK
thanks.. I am a beginner so petrified... :D
..:: Ban Terbaik di Indonesia GT Radial ::..