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
- SpeechRecognizer.cs
- WebSysDisplayNameAttribute.cs
- BitmapCodecInfo.cs
- CurrentTimeZone.cs
- LoginCancelEventArgs.cs
- CorrelationResolver.cs
- PermissionSetTriple.cs
- EncryptedData.cs
- WindowsListBox.cs
- ZipIOCentralDirectoryBlock.cs
- Object.cs
- QilCloneVisitor.cs
- SqlDelegatedTransaction.cs
- LoginAutoFormat.cs
- SQLInt32.cs
- DesignerLoader.cs
- APCustomTypeDescriptor.cs
- XamlStyleSerializer.cs
- GlobalizationSection.cs
- SqlDeflator.cs
- NodeInfo.cs
- RefreshPropertiesAttribute.cs
- MimeWriter.cs
- EndpointInstanceProvider.cs
- StrokeSerializer.cs
- FamilyCollection.cs
- TypeInformation.cs
- KeyInterop.cs
- DataBindingHandlerAttribute.cs
- ButtonFieldBase.cs
- Win32.cs
- HttpCookieCollection.cs
- ContentValidator.cs
- EntityDataSourceDataSelection.cs
- DropShadowEffect.cs
- Renderer.cs
- CustomPopupPlacement.cs
- ArrayElementGridEntry.cs
- PinProtectionHelper.cs
- WarningException.cs
- AccessorTable.cs
- PrivacyNoticeBindingElement.cs
- DataTrigger.cs
- ChtmlPhoneCallAdapter.cs
- AttributeCollection.cs
- Matrix3D.cs
- ExtensionDataObject.cs
- SynchronousChannelMergeEnumerator.cs
- PersonalizationStateInfoCollection.cs
- SqlMethods.cs
- TrustManager.cs
- SuppressIldasmAttribute.cs
- DisplayClaim.cs
- RootBrowserWindowAutomationPeer.cs
- SplayTreeNode.cs
- SettingsProviderCollection.cs
- IntSecurity.cs
- TableItemProviderWrapper.cs
- DbConnectionInternal.cs
- TextRangeAdaptor.cs
- LineVisual.cs
- CaseInsensitiveComparer.cs
- Compiler.cs
- PartialCachingAttribute.cs
- FileEnumerator.cs
- GraphicsState.cs
- Label.cs
- TemplateManager.cs
- TextElementEnumerator.cs
- RowTypeElement.cs
- PointAnimation.cs
- ItemsChangedEventArgs.cs
- Selector.cs
- BufferedGraphicsContext.cs
- FixedPosition.cs
- SmiMetaDataProperty.cs
- FileLevelControlBuilderAttribute.cs
- FixedSOMPageConstructor.cs
- ToolStripContentPanelRenderEventArgs.cs
- ProtocolsConfigurationEntry.cs
- WebPartConnectionsEventArgs.cs
- SystemIcmpV4Statistics.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- NamedPipeProcessProtocolHandler.cs
- ActivityWithResult.cs
- Bold.cs
- CopyAttributesAction.cs
- DataControlField.cs
- EventLogPermissionEntry.cs
- DocumentOutline.cs
- XmlSchemaValidationException.cs
- odbcmetadatafactory.cs
- SharedHttpsTransportManager.cs
- CompiledQuery.cs
- CodeSnippetStatement.cs
- DiagnosticsConfigurationHandler.cs
- LabelAutomationPeer.cs
- EventProvider.cs
- SqlConnectionHelper.cs
- DataControlPagerLinkButton.cs