The Web.Config file configuring a specific application lives in that application's virtual directory. If you're happy with the way Microsoft set up Web application settings using Machine.Config, you don't need to change anything in Web.Config. However, the default settings (using defaults such as inproc
session state Windows authentication) aren't useful for a production Web site.
To change these settings, you may edit the Web.Config file directly (as you had to do in the days of ASP.NET 1.x
). However, ASP.NET 2.0 includes new configuration tools that make configuring your site a very straightforward proposition.
We'll encounter ASP.NET configuration many more times in forthcoming tutorials. In fact, we'll visit configuration heavily in the next tutorial on ASP.NET security.
Tutorial 9 Quick Reference
How to view raw configuration files
Look in the Windows directory under Microsoft.NET\Framework\ ver<whatevertheversionis>\config
How to change configuration settings in a specific ASP.NET application
Place a Web.Config file in the application's virtual directory and modify the settings
How to change configuration settings for a specific subdirectory underneath a virtual directory
Place a separate Web.Config file in the subdirectory
OR
Use the
Local
element in the virtual directory's Web.Config file
How to modify a Web application's settings using the Web site Administration tool
Select
Web site | Administer Web site
from the main menu in Visual Studio
How to modify a Web application's settings using the IIS ASP.NET Configuration table
Open the IIS control panel
Highlight the virtual directory setting
Right mouse click to bring up the Properties page
Push the Configuration button
Select the ASP.NET tab
How to retrieve settings from the configuration file
Use the ASP.NET
ConfigurationManager
class