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
- SQLDoubleStorage.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- Track.cs
- XslAst.cs
- ImageClickEventArgs.cs
- DefaultSection.cs
- CreateUserWizard.cs
- PersistChildrenAttribute.cs
- ConfigXmlText.cs
- querybuilder.cs
- ImageListDesigner.cs
- TrackingMemoryStream.cs
- DiscoveryReference.cs
- SchemaElementDecl.cs
- PropertyChangingEventArgs.cs
- MemoryStream.cs
- Exception.cs
- OleDbDataAdapter.cs
- DocumentPage.cs
- Documentation.cs
- XmlSchemaGroup.cs
- ClipboardProcessor.cs
- CustomErrorsSection.cs
- ArgumentValueSerializer.cs
- ExtenderProvidedPropertyAttribute.cs
- EdmFunction.cs
- ListChangedEventArgs.cs
- SessionPageStatePersister.cs
- TabControl.cs
- HtmlTableRow.cs
- AlignmentXValidation.cs
- PingOptions.cs
- InvalidEnumArgumentException.cs
- PackWebResponse.cs
- DefaultSerializationProviderAttribute.cs
- InputLanguageManager.cs
- OutOfProcStateClientManager.cs
- ConsumerConnectionPointCollection.cs
- BamlCollectionHolder.cs
- SafeUserTokenHandle.cs
- CodeTypeDeclarationCollection.cs
- COAUTHIDENTITY.cs
- ScrollPattern.cs
- xml.cs
- XslVisitor.cs
- UriSection.cs
- OleServicesContext.cs
- InstalledFontCollection.cs
- URLMembershipCondition.cs
- ObjectDataSourceView.cs
- ConsumerConnectionPointCollection.cs
- _ScatterGatherBuffers.cs
- CompilationUtil.cs
- SafeArrayRankMismatchException.cs
- FileSecurity.cs
- KerberosTicketHashIdentifierClause.cs
- SatelliteContractVersionAttribute.cs
- XmlCharType.cs
- Decimal.cs
- ToolStripPanelRenderEventArgs.cs
- PeerNameRegistration.cs
- SmiMetaData.cs
- ScrollPattern.cs
- DataStreams.cs
- HttpProcessUtility.cs
- MenuItem.cs
- NativeMethods.cs
- ExpandCollapseProviderWrapper.cs
- EditBehavior.cs
- RootBrowserWindowAutomationPeer.cs
- Emitter.cs
- PhysicalFontFamily.cs
- RoutingTable.cs
- EventListenerClientSide.cs
- TextBox.cs
- EFTableProvider.cs
- IdnElement.cs
- RadioButtonDesigner.cs
- TargetControlTypeAttribute.cs
- ChangeDirector.cs
- Command.cs
- DisplayClaim.cs
- GetPageNumberCompletedEventArgs.cs
- Delegate.cs
- DetailsViewInsertedEventArgs.cs
- XmlReflectionMember.cs
- SimpleMailWebEventProvider.cs
- FormViewPageEventArgs.cs
- DataTable.cs
- XmlSchemaSimpleContentExtension.cs
- StylusButtonCollection.cs
- TouchFrameEventArgs.cs
- EnumValAlphaComparer.cs
- Pkcs7Recipient.cs
- _LocalDataStoreMgr.cs
- TreeViewAutomationPeer.cs
- DesignerCategoryAttribute.cs
- ServiceNameCollection.cs
- ToolStripDropDownClosingEventArgs.cs
- ImmComposition.cs