Web.config is the main settings and configuration file for an ASP.NET web application. The file is an XML document that defines configuration information regarding the web application. The web.config file contains information that control module loading, security configuration, session state configuration, and application language and compilation settings. Web.config files can also contain application specific items such as database connection strings.
Create a Web.config File
You can create a Web.config file by using a text editor such as Notepad. You must create a text file that is named Web.config in the root directory of your ASP.NET application. The Web.config file must be a well-formed XML document and must have a format similar to the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\Machine.config file.
The Web.config file must contain only entries for configuration items that override the settings in the Machine.config file. At a minimum, the Web.config file must have the element and the element. These elements will contain individual configuration elements.
The following example shows a minimal Web.config file:
The first line of the Web.config file describes the document as XML-formatted and specifies the character encoding type. This first line must be the same for all .config files.
The lines that follow mark the beginning and the end of the element and the element of the Web.config file. By themselves, these lines do nothing. However, the lines provide a structure that permits you to add future configuration settings. You add the majority of the ASP.NET configuration settings between the and lines. These lines mark the beginning and the end of the ASP.NET configuration settings.
ASP.NET Web.config file...
We should have good knowledge about the Web.config file, because it's a major character when we going to develop web applications using ASP.net. First, I like to give some examples "What we can do using the Web.config file"...And after I'll discuss how we going to code the examples.
Can create database connection using the Web.config file
According to the user log in system environment, we can modify the Authentication and Authorization.
We can set image path for the uploading images.
Also we can manage the lager size files, when uploading to the web server.
If the System.Net.Mail email sending, we should configure the Web.config file.
How to Create Database connection in the Web.config file
You can write following code before the tag and inside the tag
How to manage Form authentication and the authorization in the Web.config file.
Following code demonstrate the way it can be implement.
Then you should show the location which need to be restricted from anonymous users.
After the tag we can write following code to above purpose. It's pretty cool, isn't it..?
How we should configure the Web,config file according to the E-mail sending...
After the we should change following changes to the Web.config file
How to set the Image path when uploading images to the web..
How to upload a larger size file into the web server...
additionally we have to configure the Web.config file as follows.