- Understanding How Web Forms Are Processed
- Performing Basic State Management in Web Applications
- Using Cookies
- Using Hidden Fields and Query Strings
- Working with the Session Object
- Working with the Application Object
- Setting Up Global Objects with the global.asax File
- Configuring the Application
Configuring the Application
Configuring Web sites is much easier using ASP.NET than it is with many other solutions. ASP.NET allows you to configure almost every aspect of your site using an XML file called web.config.
The web.config file is a boon for developers who have their Web applications hosted by another company. Rather than have to deal with surly support technicians from your hosting company, you can simply upload new versions of a web.config file at will.
The web.config file is similar to the global.asax file, in that it can be stored at the root of an ASP.NET application. Also, whenever you modify the file, the ASP.NET application is automatically restarted.
Look at a sample web.config file in Listing 3.13.
Listing 3.13 Sample web.config File to Specify a Session Timeout of Five Minutes
<?xml version="1.0" ?> <configuration> <system.web> <sessionState timeout="5" /> </system.web> </configuration>
Visual Studio.NET creates a more detailed web.config file by default when you create a new Web application. On Day 18, we'll describe how to construct web.config files in detail.
As a prelude to Day 18's lesson, here is a list of some changes you can make with a web.config file:
Set default language for ASP.NET pages
Turn debugging and tracing on and off
Specify error-handling pages
Specify where session state is stored
Set the authentication mode
Set globalization parameters
Prevent pages ending in a specific extension from being downloaded
Set the browser capabilities of your site
Add assemblies to your Web site
Configure Web service
Although this book won't go into the details of each feature until Day 18, this list should give you a starting point for figuring out the default web.config file that Visual Studio generates.