[ Download Code ]
The first thing you should be familiar with is the default structure of the Web.config file. The following example is generated by Visual Studio .NET when you choose to add a new Web configuration file. [ view screenshot ]
Listing 1: Sample Web.config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Windows" />
<authorization>
<allow users="*" /> <!-- Allow all users -->
</authorization>
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true" />
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20" />
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8" />
</system.web>
</configuration>
If you are not familiar with creating a Web.config file, simply follow these steps.
- From the File menu, select New, and then Blank Solution. [ view screenshot ]
- Now that you have a Blank Solution the next step is to add a new Project. [ view screenshot ]
- In this case I am adding a VB.NET Project, and then selecting an ASP.NET Web Application choice. [ view screenshot ]
- Once your new Project has been established, you should see a screen similar to the following [ view screenshot ]. Notice that Visual Studio .NET has created a Web.config file. This default configuration file will have the settings shown in Listing 1.
- If you want to create additional Web configuration files within any folders you have created within this project, right-click the folder in the Solution Explorer, and select Add, Add New Item, and Web Configuration File. [ view screenshot ]
Now that you have been provided with two methods of establishing a Web configuration file, it is time to move on to breaking this file down into greater details.