private static RuntimeConfig GetClientRuntimeConfig()
 {
     if (s_clientRuntimeConfig == null)
     {
         s_clientRuntimeConfig = new ClientRuntimeConfig();
     }
     return s_clientRuntimeConfig;
 }
        //
        // Constructor
        //
        internal CachedPathData(string configPath, VirtualPath virtualPath, string physicalPath, bool exists) {
            // Guarantee that we return a non-null config record
            // if an error occurs during initialization.
            _runtimeConfig = RuntimeConfig.GetErrorRuntimeConfig();
            _configPath = configPath;
            _virtualPath = virtualPath;
            _physicalPath = physicalPath;
            _flags[FExists] = exists;

            // VSWhidbey 607683: Config loading for web app has a dependency on CachedPathData.
            // On the other hand, Config also has a dependency on Uri class which has
            // a new static constructor that calls config, and eventually to CachedPathData again.
            // We need a dummy reference to Uri class so the static constructor would be involved
            // first to initialize config.
            string dummy = System.Uri.SchemeDelimiter;

        }
 private void Init(CachedPathData parentData)
 {
     if (!HttpConfigurationSystem.UseHttpConfigurationSystem)
     {
         this._runtimeConfig = null;
     }
     else
     {
         IInternalConfigRecord uniqueConfigRecord = HttpConfigurationSystem.GetUniqueConfigRecord(this._configPath);
         if (uniqueConfigRecord.ConfigPath.Length == this._configPath.Length)
         {
             this._flags[0x10]   = true;
             this._runtimeConfig = new System.Web.Configuration.RuntimeConfig(uniqueConfigRecord);
         }
         else
         {
             this._runtimeConfig = parentData._runtimeConfig;
         }
     }
 }
        // Initialize the data
        void Init(CachedPathData parentData) {
            // Note that _runtimeConfig will be set to the singleton instance of ErrorRuntimeConfig
            // if a ThreadAbortException is thrown during this method.
            Debug.Assert(_runtimeConfig == RuntimeConfig.GetErrorRuntimeConfig(), "_runtimeConfig == RuntimeConfig.GetErrorRuntimeConfig()");

            if (!HttpConfigurationSystem.UseHttpConfigurationSystem) {
                // 
                // configRecord may legitimately be null if we are not using the HttpConfigurationSystem.
                //
                _runtimeConfig = null;
            }
            else {
                IInternalConfigRecord configRecord = HttpConfigurationSystem.GetUniqueConfigRecord(_configPath);
                Debug.Assert(configRecord != null, "configRecord != null");

                if (configRecord.ConfigPath.Length == _configPath.Length) {
                    //
                    // The config is unique to this path, so this make this record the owner of the config.
                    //
                    _flags[FOwnsConfigRecord] = true;
                    _runtimeConfig = new RuntimeConfig(configRecord);
                }
                else {
                    //
                    // The config record is the same as an ancestor's, so use the parent's RuntimeConfig.
                    //
                    Debug.Assert(parentData != null, "parentData != null");
                    _runtimeConfig = parentData._runtimeConfig;
                }
            }
        }
 private static bool InitializeSettings(bool initializeGeneralSettings, RuntimeConfig appConfig, MembershipSection settings)
 {
     if (!initializeGeneralSettings)
     {
         return false;
     }
     s_HashAlgorithmType = settings.HashAlgorithmType;
     s_HashAlgorithmFromConfig = !string.IsNullOrEmpty(s_HashAlgorithmType);
     if (!s_HashAlgorithmFromConfig)
     {
         MachineKeyValidation validation = appConfig.MachineKey.Validation;
         if ((validation != MachineKeyValidation.AES) && (validation != MachineKeyValidation.TripleDES))
         {
             s_HashAlgorithmType = appConfig.MachineKey.ValidationAlgorithm;
         }
         else
         {
             s_HashAlgorithmType = "SHA1";
         }
     }
     s_Providers = new MembershipProviderCollection();
     if (HostingEnvironment.IsHosted)
     {
         ProvidersHelper.InstantiateProviders(settings.Providers, s_Providers, typeof(MembershipProvider));
     }
     else
     {
         foreach (ProviderSettings settings2 in settings.Providers)
         {
             Type c = Type.GetType(settings2.Type, true, true);
             if (!typeof(MembershipProvider).IsAssignableFrom(c))
             {
                 throw new ArgumentException(System.Web.SR.GetString("Provider_must_implement_type", new object[] { typeof(MembershipProvider).ToString() }));
             }
             MembershipProvider provider = (MembershipProvider) Activator.CreateInstance(c);
             NameValueCollection parameters = settings2.Parameters;
             NameValueCollection config = new NameValueCollection(parameters.Count, StringComparer.Ordinal);
             foreach (string str in parameters)
             {
                 config[str] = parameters[str];
             }
             provider.Initialize(settings2.Name, config);
             s_Providers.Add(provider);
         }
     }
     s_UserIsOnlineTimeWindow = (int) settings.UserIsOnlineTimeWindow.TotalMinutes;
     return true;
 }
 private void Init(CachedPathData parentData)
 {
     if (!HttpConfigurationSystem.UseHttpConfigurationSystem)
     {
         this._runtimeConfig = null;
     }
     else
     {
         IInternalConfigRecord uniqueConfigRecord = HttpConfigurationSystem.GetUniqueConfigRecord(this._configPath);
         if (uniqueConfigRecord.ConfigPath.Length == this._configPath.Length)
         {
             this._flags[0x10] = true;
             this._runtimeConfig = new System.Web.Configuration.RuntimeConfig(uniqueConfigRecord);
         }
         else
         {
             this._runtimeConfig = parentData._runtimeConfig;
         }
     }
 }
        private static bool InitializeSettings(bool initializeGeneralSettings, RuntimeConfig appConfig, MembershipSection settings) {
            if (!initializeGeneralSettings) {
                return false;
            }

            s_HashAlgorithmType = settings.HashAlgorithmType;
            s_HashAlgorithmFromConfig = !string.IsNullOrEmpty(s_HashAlgorithmType);
            if (!s_HashAlgorithmFromConfig) {
                // If no hash algorithm is specified, use the same as the "validation" in "<machineKey>".
                // If the validation is "3DES", switch it to use "SHA1" instead.
                MachineKeyValidation v = appConfig.MachineKey.Validation;
                if (v != MachineKeyValidation.AES && v != MachineKeyValidation.TripleDES)
                    s_HashAlgorithmType = appConfig.MachineKey.ValidationAlgorithm;
                else
                    s_HashAlgorithmType = "SHA1";
            }
            s_Providers = new MembershipProviderCollection();
            if (HostingEnvironment.IsHosted) {
                ProvidersHelper.InstantiateProviders(settings.Providers, s_Providers, typeof(MembershipProvider));
            } else {
                foreach (ProviderSettings ps in settings.Providers) {
                    Type t = Type.GetType(ps.Type, true, true);
                    if (!typeof(MembershipProvider).IsAssignableFrom(t))
                        throw new ArgumentException(SR.GetString(SR.Provider_must_implement_type, typeof(MembershipProvider).ToString()));
                    MembershipProvider provider = (MembershipProvider)Activator.CreateInstance(t);
                    NameValueCollection pars = ps.Parameters;
                    NameValueCollection cloneParams = new NameValueCollection(pars.Count, StringComparer.Ordinal);
                    foreach (string key in pars)
                        cloneParams[key] = pars[key];
                    provider.Initialize(ps.Name, cloneParams);
                    s_Providers.Add(provider);
                }
            }

            TimeSpan timeWindow = settings.UserIsOnlineTimeWindow;
            s_UserIsOnlineTimeWindow = (int)timeWindow.TotalMinutes;

            return true;
        }
        // Create the single instance of the wrapper for error configuration.
        static internal RuntimeConfig GetErrorRuntimeConfig() {
            if (s_errorRuntimeConfig == null) {
                s_errorRuntimeConfig = new ErrorRuntimeConfig();
            }

            return s_errorRuntimeConfig;
        }
        // Create the single instance of the wrapper for null configuration.
        static RuntimeConfig GetNullRuntimeConfig() {
            if (s_nullRuntimeConfig == null) {
                s_nullRuntimeConfig = new NullRuntimeConfig();
            }

            return s_nullRuntimeConfig;
        }