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
- Vector3D.cs
- Propagator.JoinPropagator.cs
- HandleCollector.cs
- Stack.cs
- WhitespaceRule.cs
- PointAnimationUsingPath.cs
- DataTableCollection.cs
- AnnotationService.cs
- WorkflowPrinting.cs
- PointHitTestResult.cs
- WindowsStatic.cs
- GridToolTip.cs
- ControlsConfig.cs
- IsolatedStorageFileStream.cs
- HandleValueEditor.cs
- CodeMethodReturnStatement.cs
- WindowProviderWrapper.cs
- CodePrimitiveExpression.cs
- ProtocolsConfigurationEntry.cs
- ThreadExceptionEvent.cs
- ResourceCollectionInfo.cs
- LinkConverter.cs
- ControlBuilder.cs
- ExtenderProvidedPropertyAttribute.cs
- BaseProcessProtocolHandler.cs
- RichTextBoxDesigner.cs
- PolyLineSegment.cs
- WriteTimeStream.cs
- UICuesEvent.cs
- CacheMemory.cs
- ClientUIRequest.cs
- GeneralTransform3D.cs
- FrameSecurityDescriptor.cs
- ParameterRetriever.cs
- OutOfProcStateClientManager.cs
- AdornerLayer.cs
- SourceFileBuildProvider.cs
- EntityDataSourceColumn.cs
- DataSourceComponent.cs
- DataGridTemplateColumn.cs
- TokenizerHelper.cs
- FunctionNode.cs
- ImmComposition.cs
- DataGridViewDataConnection.cs
- Size.cs
- MonthCalendar.cs
- SqlDataAdapter.cs
- ConnectionManagementElementCollection.cs
- ProxyFragment.cs
- TemplateKeyConverter.cs
- DateBoldEvent.cs
- XamlStream.cs
- TraceUtility.cs
- IntSecurity.cs
- AuthenticationModulesSection.cs
- EventWaitHandleSecurity.cs
- ParameterCollection.cs
- Config.cs
- ArrayMergeHelper.cs
- RawMouseInputReport.cs
- DecoderNLS.cs
- TableCell.cs
- IsolatedStorageFile.cs
- ValidationEventArgs.cs
- StringAnimationBase.cs
- ProcessModelSection.cs
- QfeChecker.cs
- SecurityCriticalDataForSet.cs
- ImplicitInputBrush.cs
- FigureParaClient.cs
- COM2ExtendedUITypeEditor.cs
- RelOps.cs
- _LoggingObject.cs
- TextParentUndoUnit.cs
- EntityContainerRelationshipSet.cs
- FlowDocumentPage.cs
- DesignerActionService.cs
- UidManager.cs
- MatrixUtil.cs
- _NegotiateClient.cs
- IPipelineRuntime.cs
- DataGridAutomationPeer.cs
- ComponentCodeDomSerializer.cs
- SR.cs
- HealthMonitoringSectionHelper.cs
- LambdaCompiler.Unary.cs
- XmlAutoDetectWriter.cs
- TypedReference.cs
- SrgsElementFactory.cs
- ExpandedWrapper.cs
- PageVisual.cs
- IPAddressCollection.cs
- WebPartTransformerAttribute.cs
- CodeCatchClause.cs
- GridLengthConverter.cs
- AmbiguousMatchException.cs
- SspiSecurityToken.cs
- Validator.cs
- OleDbException.cs
- FilePrompt.cs