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
- RowVisual.cs
- HMAC.cs
- Compiler.cs
- HwndMouseInputProvider.cs
- ControlCollection.cs
- QueryableDataSource.cs
- TextBoxBase.cs
- SqlUdtInfo.cs
- DoubleLink.cs
- SQLGuidStorage.cs
- StateMachine.cs
- BamlWriter.cs
- WorkerRequest.cs
- BulletedList.cs
- AppDomainManager.cs
- InvokeHandlers.cs
- GestureRecognizer.cs
- QueryInterceptorAttribute.cs
- ShellProvider.cs
- DataRecordInfo.cs
- ListView.cs
- Statements.cs
- DataContractAttribute.cs
- SoapExtensionTypeElementCollection.cs
- CustomValidator.cs
- EasingQuaternionKeyFrame.cs
- TextParentUndoUnit.cs
- TemplateLookupAction.cs
- ModifiableIteratorCollection.cs
- KeyboardEventArgs.cs
- IDataContractSurrogate.cs
- SkewTransform.cs
- XPathNavigatorKeyComparer.cs
- SiteMembershipCondition.cs
- FileDialogCustomPlace.cs
- ObjectConverter.cs
- RuleRefElement.cs
- SignedPkcs7.cs
- GregorianCalendarHelper.cs
- CaseStatementProjectedSlot.cs
- ReflectTypeDescriptionProvider.cs
- HttpSessionStateWrapper.cs
- SortAction.cs
- DBDataPermissionAttribute.cs
- ValidationResult.cs
- DataGridColumnHeaderCollection.cs
- BitmapMetadataBlob.cs
- WebPartZoneCollection.cs
- AddInToken.cs
- StatusBarPanel.cs
- SqlCacheDependencySection.cs
- Types.cs
- DataRelation.cs
- Validator.cs
- ConditionedDesigner.cs
- XslNumber.cs
- StylusPointPropertyUnit.cs
- DispatchProxy.cs
- IRCollection.cs
- CheckBox.cs
- HelpKeywordAttribute.cs
- InputReport.cs
- UpdateCommand.cs
- Int16Animation.cs
- InkCanvasFeedbackAdorner.cs
- XPathAxisIterator.cs
- UnsafeNativeMethods.cs
- AxisAngleRotation3D.cs
- InteropAutomationProvider.cs
- DockAndAnchorLayout.cs
- TransformedBitmap.cs
- DataTableMappingCollection.cs
- AssemblyBuilder.cs
- DbModificationCommandTree.cs
- TextTreeRootNode.cs
- UnsafeNativeMethods.cs
- RenderOptions.cs
- SqlCommandSet.cs
- XmlTextAttribute.cs
- ThemeDirectoryCompiler.cs
- ProtocolsConfigurationHandler.cs
- PersonalizationProviderCollection.cs
- CodeThrowExceptionStatement.cs
- WpfXamlMember.cs
- COM2Enum.cs
- PathSegment.cs
- CodeObject.cs
- LocationUpdates.cs
- GestureRecognizer.cs
- UnsafeNativeMethodsPenimc.cs
- DomainUpDown.cs
- EndEvent.cs
- SystemBrushes.cs
- CompareValidator.cs
- HttpResponseBase.cs
- CryptoApi.cs
- MenuItemBinding.cs
- NameValueSectionHandler.cs
- QueryCursorEventArgs.cs
- Parameter.cs