// Instantiates and manages the viewstate providers according to the // registered providers in the "viewStateServices" section in web.config. private static void LoadProviders() { // providers are loaded just once if (provider == null) { // Synchronize the process of loading the providers lock (locker) { // Confirm that _provider is still null if (provider == null) { // Get a reference to the <viewstateService> section var section = (ViewStateProviderServiceSection) WebConfigurationManager.GetSection("myviewstateSection/viewstateService"); // Load all registered providers providers = new ViewStateProviderCollection(); ProvidersHelper.InstantiateProviders (section.Providers, providers, typeof(ViewStateProviderBase)); // Set _provider to the default provider provider = providers[section.DefaultProvider]; } } } }