
Stefan Schackow spoke at teched Tuesday on "ASP.NET: Under the Covers - Creating High-Availability, Scalable Web Applications." We posted Stefan's newest excerpt article from his Wrox book Professional ASP.NET 2.0 Security, Membership, and Role Management on Wrox.com this week. Here's the beginning of the article titled "Redirecting Configuration with a Custom Provider."
A common issue with Web applications is that applications are managed in various environments. Aside from development environments, you may have test servers, staging servers, live production servers, and potentially warm backup servers. If you store selected Web configuration sections in a central location (such as a central file share or a central configuration database), you have a more manageable solution and, depending on how you implement this, a more secure solution as well.
With ASP.NET 2.0, you can write a custom protected configuration provider that determines information about the current server and the currently running application. A custom provider can reach out to a central repository of configuration information and return the appropriate configuration information. When you have a group of individuals who manage the configuration data for live production servers, it is probably much easier to have such a group manage updates to a single database as opposed to synchronizing configuration files across multiple machines.
Implementing a custom protected configuration provider requires you to derive from the System.Configuration.ProtectedConfigurationProvider class. As you can see, the class signature is very basic:
You can dive into the code with Stefan in the rest of the article.
Recent Comments