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
- ArrayMergeHelper.cs
- EntityContainerRelationshipSetEnd.cs
- CustomSignedXml.cs
- TileModeValidation.cs
- CompositeCollectionView.cs
- HtmlAnchor.cs
- SeparatorAutomationPeer.cs
- _HeaderInfoTable.cs
- DataGridHeaderBorder.cs
- PropertyRef.cs
- WizardStepBase.cs
- SQLBinary.cs
- RelatedImageListAttribute.cs
- SoundPlayer.cs
- Container.cs
- AlignmentYValidation.cs
- FormattedTextSymbols.cs
- FileFormatException.cs
- SQLSingle.cs
- SHA512Managed.cs
- XmlSchemaValidationException.cs
- ConnectionPointCookie.cs
- OletxEnlistment.cs
- DoubleConverter.cs
- ServiceMetadataBehavior.cs
- SHA512Managed.cs
- CustomCategoryAttribute.cs
- CalendarDateRange.cs
- RemotingService.cs
- MapPathBasedVirtualPathProvider.cs
- DictionaryItemsCollection.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- jithelpers.cs
- UserControlAutomationPeer.cs
- ListBox.cs
- TraceHandlerErrorFormatter.cs
- CalendarAutomationPeer.cs
- UrlAuthorizationModule.cs
- WsatServiceAddress.cs
- ActivityWithResultConverter.cs
- ServicesUtilities.cs
- XmlSchemaSimpleType.cs
- SourceFileBuildProvider.cs
- ZipIOExtraFieldElement.cs
- FileLevelControlBuilderAttribute.cs
- BooleanFunctions.cs
- ListManagerBindingsCollection.cs
- MetaModel.cs
- XmlCharType.cs
- NativeCppClassAttribute.cs
- CryptoHelper.cs
- SignedXml.cs
- AuthenticationModuleElementCollection.cs
- WebCategoryAttribute.cs
- Highlights.cs
- BindingsCollection.cs
- DataGridViewTextBoxColumn.cs
- SimpleMailWebEventProvider.cs
- GradientBrush.cs
- ProcessModuleCollection.cs
- RepeatInfo.cs
- BitmapMetadata.cs
- TableCellAutomationPeer.cs
- ScrollItemPatternIdentifiers.cs
- FormatControl.cs
- DependencyObjectPropertyDescriptor.cs
- CompilationUnit.cs
- RSAPKCS1SignatureDeformatter.cs
- References.cs
- AndCondition.cs
- DataGridBeginningEditEventArgs.cs
- IndexedGlyphRun.cs
- StackBuilderSink.cs
- VariantWrapper.cs
- SessionStateSection.cs
- StaticTextPointer.cs
- MimeTypeMapper.cs
- FamilyMap.cs
- HttpAsyncResult.cs
- ServiceBusyException.cs
- CustomCredentialPolicy.cs
- EnumMemberAttribute.cs
- TextInfo.cs
- TrackBar.cs
- CustomErrorCollection.cs
- ComboBoxRenderer.cs
- HtmlInputText.cs
- DesignerAutoFormatStyle.cs
- MatrixAnimationUsingKeyFrames.cs
- PackagingUtilities.cs
- WebServiceClientProxyGenerator.cs
- Thumb.cs
- DataControlPagerLinkButton.cs
- BrowserDefinitionCollection.cs
- Currency.cs
- FormsAuthenticationConfiguration.cs
- FloatMinMaxAggregationOperator.cs
- DigitShape.cs
- HttpWrapper.cs
- NameValueCollection.cs