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
- OracleBoolean.cs
- ControlValuePropertyAttribute.cs
- DataGridPageChangedEventArgs.cs
- ReferencedType.cs
- EventDescriptor.cs
- ReflectPropertyDescriptor.cs
- XmlHierarchyData.cs
- HostProtectionPermission.cs
- SqlColumnizer.cs
- DockProviderWrapper.cs
- DefaultObjectMappingItemCollection.cs
- IUnknownConstantAttribute.cs
- KerberosSecurityTokenAuthenticator.cs
- SmuggledIUnknown.cs
- MemoryFailPoint.cs
- FontStyle.cs
- PriorityQueue.cs
- UserControlAutomationPeer.cs
- AttachInfo.cs
- CacheChildrenQuery.cs
- MeasureData.cs
- DocumentSequenceHighlightLayer.cs
- ExternalException.cs
- localization.cs
- ChannelServices.cs
- QuaternionAnimation.cs
- CodeTypeReferenceSerializer.cs
- TypeSource.cs
- UDPClient.cs
- TreeView.cs
- KeyboardEventArgs.cs
- DbConnectionPoolOptions.cs
- IndentedWriter.cs
- NamespaceDecl.cs
- SvcMapFile.cs
- TdsParserSessionPool.cs
- TagMapInfo.cs
- XmlComplianceUtil.cs
- WinEventQueueItem.cs
- EdmToObjectNamespaceMap.cs
- WebSysDescriptionAttribute.cs
- TabPage.cs
- UriScheme.cs
- TemplatedEditableDesignerRegion.cs
- MatrixTransform.cs
- DropDownList.cs
- InputMethod.cs
- BadImageFormatException.cs
- control.ime.cs
- SqlNodeAnnotation.cs
- UnionCodeGroup.cs
- _RequestCacheProtocol.cs
- RuntimeResourceSet.cs
- Filter.cs
- RIPEMD160.cs
- WebRequestModuleElement.cs
- TextReturnReader.cs
- ConnectionProviderAttribute.cs
- AgileSafeNativeMemoryHandle.cs
- ToolStripDropDown.cs
- Int16AnimationUsingKeyFrames.cs
- path.cs
- DataGridViewSelectedRowCollection.cs
- SqlResolver.cs
- RegexBoyerMoore.cs
- HasCopySemanticsAttribute.cs
- AdRotator.cs
- WsdlBuildProvider.cs
- WebPartEventArgs.cs
- X509Certificate.cs
- CodeDelegateCreateExpression.cs
- UnicodeEncoding.cs
- ApplicationActivator.cs
- TextLineBreak.cs
- DescendantOverDescendantQuery.cs
- DiagnosticTrace.cs
- SplitterEvent.cs
- BitmapFrameDecode.cs
- ScriptControl.cs
- FontFamily.cs
- OleStrCAMarshaler.cs
- MissingMethodException.cs
- TextBoxBase.cs
- ConstructorNeedsTagAttribute.cs
- QilPatternVisitor.cs
- FileStream.cs
- HwndKeyboardInputProvider.cs
- HtmlInputImage.cs
- MbpInfo.cs
- ApplicationSettingsBase.cs
- formatstringdialog.cs
- ComponentResourceKeyConverter.cs
- NativeMethods.cs
- CngKey.cs
- KnownIds.cs
- PropertyTabChangedEvent.cs
- InputLanguage.cs
- ObjectParameter.cs
- SelectionEditor.cs
- InputLanguage.cs