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
- DispatcherObject.cs
- FixedDocumentPaginator.cs
- CodeArrayCreateExpression.cs
- XNodeNavigator.cs
- DataGridViewCellValueEventArgs.cs
- ComponentGlyph.cs
- UntypedNullExpression.cs
- PersonalizationAdministration.cs
- SessionStateContainer.cs
- BufferedGraphicsContext.cs
- PerformanceCounterManager.cs
- StorageConditionPropertyMapping.cs
- Funcletizer.cs
- SqlTypesSchemaImporter.cs
- DynamicRendererThreadManager.cs
- HostingEnvironmentException.cs
- PerformanceCounterPermissionEntryCollection.cs
- ReferencedType.cs
- TTSEvent.cs
- formatstringdialog.cs
- ContractComponent.cs
- ObjectHandle.cs
- SByte.cs
- PageThemeCodeDomTreeGenerator.cs
- EntityDesignPluralizationHandler.cs
- BuildProvider.cs
- ToolStripOverflowButton.cs
- SortAction.cs
- SmtpTransport.cs
- EncryptedData.cs
- XmlAggregates.cs
- AutomationAttributeInfo.cs
- ComNativeDescriptor.cs
- VisualStyleInformation.cs
- ReachDocumentReferenceSerializer.cs
- ComplexType.cs
- Regex.cs
- PackWebResponse.cs
- ExtensionWindowResizeGrip.cs
- HtmlEmptyTagControlBuilder.cs
- AuditLog.cs
- RenderData.cs
- _FtpDataStream.cs
- GlobalizationSection.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- XmlDomTextWriter.cs
- SqlMethods.cs
- ProfileParameter.cs
- XPathNavigator.cs
- RegexRunner.cs
- GlyphRunDrawing.cs
- DetailsViewRow.cs
- OracleConnectionStringBuilder.cs
- HMACSHA256.cs
- DbUpdateCommandTree.cs
- MainMenu.cs
- FontNameEditor.cs
- AppSecurityManager.cs
- XmlDataFileEditor.cs
- DataGridCommandEventArgs.cs
- MouseDevice.cs
- HtmlControlAdapter.cs
- ExpressionVisitor.cs
- SessionParameter.cs
- PagedDataSource.cs
- DesignerRegionCollection.cs
- OdbcStatementHandle.cs
- FileUtil.cs
- XmlDataImplementation.cs
- TemplateContent.cs
- ipaddressinformationcollection.cs
- SchemaNamespaceManager.cs
- StylusOverProperty.cs
- StructuralObject.cs
- GroupLabel.cs
- CryptoApi.cs
- BinaryUtilClasses.cs
- ScrollBar.cs
- RegionInfo.cs
- PolicyException.cs
- Win32Exception.cs
- QilNode.cs
- BrushValueSerializer.cs
- EditorPartCollection.cs
- FloaterBaseParagraph.cs
- RegexStringValidatorAttribute.cs
- ToolStripItemGlyph.cs
- XomlCompilerParameters.cs
- KoreanLunisolarCalendar.cs
- LexicalChunk.cs
- ThemeDictionaryExtension.cs
- CodeBinaryOperatorExpression.cs
- Attribute.cs
- SimpleType.cs
- DataBindingList.cs
- _ShellExpression.cs
- PermissionSet.cs
- ViewKeyConstraint.cs
- DialogResultConverter.cs
- ToolStripSettings.cs