Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Util / AppSettings.cs / 1407647 / AppSettings.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- // AppSettings.cs // using System; using System.Collections.Specialized; using System.Web; namespace System.Web.Util { internal static class AppSettings { private static volatile bool _settingsInitialized = false; private static object _appSettingsLock = new object(); private static void EnsureSettingsLoaded() { if (!_settingsInitialized) { lock (_appSettingsLock) { if (!_settingsInitialized) { NameValueCollection settings = null; try { // Check the app-level config. Ignore configuration errors CachedPathData appPathData = CachedPathData.GetApplicationPathData(); if (appPathData != null && appPathData.ConfigRecord != null) settings = appPathData.ConfigRecord.GetSection("appSettings") as NameValueCollection; } finally { // GetApplicationPathData may throw. That's fine. Let the user see the exception // once, but just fall back on default settings for the future. if (settings == null || !Boolean.TryParse(settings["aspnet:UseHostHeaderForRequestUrl"], out _useHostHeaderForRequestUrl)) _useHostHeaderForRequestUrl = false; _settingsInitialized = true; } } } } } private static bool _useHostHeaderForRequestUrl; internal static bool UseHostHeaderForRequestUrl { get { EnsureSettingsLoaded(); return _useHostHeaderForRequestUrl; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- // AppSettings.cs // using System; using System.Collections.Specialized; using System.Web; namespace System.Web.Util { internal static class AppSettings { private static volatile bool _settingsInitialized = false; private static object _appSettingsLock = new object(); private static void EnsureSettingsLoaded() { if (!_settingsInitialized) { lock (_appSettingsLock) { if (!_settingsInitialized) { NameValueCollection settings = null; try { // Check the app-level config. Ignore configuration errors CachedPathData appPathData = CachedPathData.GetApplicationPathData(); if (appPathData != null && appPathData.ConfigRecord != null) settings = appPathData.ConfigRecord.GetSection("appSettings") as NameValueCollection; } finally { // GetApplicationPathData may throw. That's fine. Let the user see the exception // once, but just fall back on default settings for the future. if (settings == null || !Boolean.TryParse(settings["aspnet:UseHostHeaderForRequestUrl"], out _useHostHeaderForRequestUrl)) _useHostHeaderForRequestUrl = false; _settingsInitialized = true; } } } } } private static bool _useHostHeaderForRequestUrl; internal static bool UseHostHeaderForRequestUrl { get { EnsureSettingsLoaded(); return _useHostHeaderForRequestUrl; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WebPartConnectionsConfigureVerb.cs
- BufferedOutputAsyncStream.cs
- InvalidPropValue.cs
- MediaCommands.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- SimpleApplicationHost.cs
- Int16KeyFrameCollection.cs
- StreamUpgradeInitiator.cs
- DebugView.cs
- AliasedSlot.cs
- ToolStripActionList.cs
- FileNameEditor.cs
- _ListenerResponseStream.cs
- HttpModuleActionCollection.cs
- TableAutomationPeer.cs
- WebRequest.cs
- ImageSourceValueSerializer.cs
- PointF.cs
- DataBindingCollectionEditor.cs
- NameScope.cs
- EventItfInfo.cs
- SmiConnection.cs
- MD5.cs
- TextCharacters.cs
- SafeSecurityHelper.cs
- COM2IDispatchConverter.cs
- ChameleonKey.cs
- FilterableAttribute.cs
- ProgressBar.cs
- TemplateParser.cs
- BitConverter.cs
- XmlSchemaComplexType.cs
- FileSecurity.cs
- MachineKeySection.cs
- OrderedDictionary.cs
- ProviderConnectionPoint.cs
- securestring.cs
- DBBindings.cs
- SystemInfo.cs
- GroupQuery.cs
- HebrewNumber.cs
- SupportsEventValidationAttribute.cs
- MasterPage.cs
- EventLogPermission.cs
- FrameworkName.cs
- BitmapEffectGeneralTransform.cs
- TypeEnumerableViewSchema.cs
- SuppressMergeCheckAttribute.cs
- WebPartEditVerb.cs
- InkPresenter.cs
- PropertyGroupDescription.cs
- Literal.cs
- Accessible.cs
- TimersDescriptionAttribute.cs
- OleDbConnection.cs
- CompilerLocalReference.cs
- HtmlInputControl.cs
- ConfigXmlDocument.cs
- ResourceSet.cs
- AssemblyAssociatedContentFileAttribute.cs
- SelectionRangeConverter.cs
- SpecularMaterial.cs
- clipboard.cs
- XhtmlConformanceSection.cs
- DPTypeDescriptorContext.cs
- Int32Animation.cs
- SliderAutomationPeer.cs
- XmlSchemaComplexContent.cs
- MenuItemBindingCollection.cs
- XamlWrapperReaders.cs
- VideoDrawing.cs
- SizeValueSerializer.cs
- InvokeHandlers.cs
- MdiWindowListStrip.cs
- ResolvedKeyFrameEntry.cs
- Group.cs
- VideoDrawing.cs
- SerialStream.cs
- TypeDelegator.cs
- OdbcUtils.cs
- ReplyChannelAcceptor.cs
- SymLanguageVendor.cs
- SqlNotificationRequest.cs
- LinearGradientBrush.cs
- ListViewItem.cs
- Animatable.cs
- DefaultBindingPropertyAttribute.cs
- HttpFileCollection.cs
- X509CertificateInitiatorClientCredential.cs
- xsdvalidator.cs
- DataGridViewCellFormattingEventArgs.cs
- AnimationTimeline.cs
- HttpCacheVaryByContentEncodings.cs
- ProjectionCamera.cs
- PropertyTabAttribute.cs
- ServicePerformanceCounters.cs
- PointConverter.cs
- Base64Decoder.cs
- DbProviderConfigurationHandler.cs
- LinqDataSourceDisposeEventArgs.cs