ASP.Net configuration

Although it can be used in production sites, simply editing the web.config XML file, is not particularly user friendly. So this article introduces Visual Studio 2005's WSAT to configure your web application.

Using Visual Studio 2005’s WSAT to configure your web application

Configuration is one of ASP.NET’s powerful features. Although it can be used in production sites by simply editing the web.config XML file, we tend to forget how to add impersonation or custom error pages to the configuration file, or we are unaware of XML’s case sensitivity. For these reasons, editing web.config is not particularly user friendly.

A tool within Visual Studio 2005 simplifies that task. Web Site Administration Tool, or WSAT, enables you to manage your configuration using a simple web interface. Think of it as a visual editor for the web.config file. It’s also handy if you need to manage the site remotely.

When you make changes to the settings in the WSAT, they will be reflected in the web.config file and your application will restart. While you are developing your site, you can start the WSAT by clicking the ASP.NET configuration in the web site menu.

216-wsat.gif

WSAT set up

As shown in the screen image above, WSAT is divided into three main sections: security, application and provider. Under the security tab, you can specify the authentication mode using the wizard, define users and groups, and indicate directory permissions and create access rules.

The application section, which is significant for developers, enables you to easily manage general application settings, such as creating name/value pairs, and access these values in the code using the ConfigurationManager class. You can also configure Simple Mail Transfer Protocol (SMTP) settings and trace and debug problems with your web application. This is where you take your application offline for maintenance as well, enabling you to edit pages or other files without worrying that a page will be called while you’re working.

Under the provider tab you can test or assign providers for membership and role management of your web site. WSAT configures and uses Microsoft SQL Server Express edition by default, and it creates a database in the App_Data folder. You can use a different provider for your membership management.

Important things to remember

Like editing the web.config file, the changes you make in the WSAT take effect immediately and require that the web site be restarted. Since this causes active sessions to be lost, always make configuration changes to a development version.

The WSAT will also time-out for security reasons. If it’s idle for a specified amount of time with being saved, your changes will be lost.

Finally, WSAT is only available with Visual Studio 2005. You can find WSAT source code in:
%Systemroot%\Microsoft.NET\Framework\v2.0.50215\ASP.NETWebAdminFiles.

Conclusion

WSAT is an excellent tool that enables developers to manage their web site configuration settings easily and efficiently. To read more about it, see http://msdn2.microsoft.com/en-us/library/yy40ytx0.aspx.