Understanding the Web Configuration File - Part 1
page 2 of 6
by Steven Swafford
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 57989/ 87

Your First Web Configuration File

[ 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.

  1. From the File menu, select New, and then Blank Solution. [ view screenshot ]
  2. Now that you have a Blank Solution the next step is to add a new Project. [ view screenshot ]
  3. In this case I am adding a VB.NET Project, and then selecting an ASP.NET Web Application choice. [ view screenshot ]
  4. 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.
  5. 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.


View Entire Article

User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-05-25 11:30:31 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search