Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / xsp / System / Web / Extensions / ui / DeploymentSectionCache.cs / 1 / DeploymentSectionCache.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI {
using System;
using System.Configuration;
using System.Security;
using System.Security.Permissions;
using System.Web.Configuration;
// DeploymentSection can only be defined in machine.config, so it is safe to cache statically in the application
internal sealed class DeploymentSectionCache : IDeploymentSection {
private static readonly DeploymentSectionCache _instance = new DeploymentSectionCache();
// Value is cached statically, because DeploymentSectionCache is a Singleton.
private bool? _retail;
private DeploymentSectionCache() {
}
public static DeploymentSectionCache Instance {
get {
return _instance;
}
}
public bool Retail {
get {
if (_retail == null) {
_retail = GetRetailFromConfig();
}
return _retail.Value;
}
}
[
ConfigurationPermission(SecurityAction.Assert, Unrestricted = true),
SecurityCritical(),
SecurityTreatAsSafe(),
]
private static bool GetRetailFromConfig() {
DeploymentSection section = (DeploymentSection)WebConfigurationManager.GetSection("system.web/deployment");
return section.Retail;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.UI {
using System;
using System.Configuration;
using System.Security;
using System.Security.Permissions;
using System.Web.Configuration;
// DeploymentSection can only be defined in machine.config, so it is safe to cache statically in the application
internal sealed class DeploymentSectionCache : IDeploymentSection {
private static readonly DeploymentSectionCache _instance = new DeploymentSectionCache();
// Value is cached statically, because DeploymentSectionCache is a Singleton.
private bool? _retail;
private DeploymentSectionCache() {
}
public static DeploymentSectionCache Instance {
get {
return _instance;
}
}
public bool Retail {
get {
if (_retail == null) {
_retail = GetRetailFromConfig();
}
return _retail.Value;
}
}
[
ConfigurationPermission(SecurityAction.Assert, Unrestricted = true),
SecurityCritical(),
SecurityTreatAsSafe(),
]
private static bool GetRetailFromConfig() {
DeploymentSection section = (DeploymentSection)WebConfigurationManager.GetSection("system.web/deployment");
return section.Retail;
}
}
}
// 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
- CultureTableRecord.cs
- IteratorDescriptor.cs
- StorageModelBuildProvider.cs
- JapaneseLunisolarCalendar.cs
- UnmanagedBitmapWrapper.cs
- ProfileElement.cs
- MessageSmuggler.cs
- StateWorkerRequest.cs
- EntityCodeGenerator.cs
- FrameDimension.cs
- Window.cs
- PersonalizationStateInfo.cs
- ImageListStreamer.cs
- QilFactory.cs
- brushes.cs
- InfoCardServiceInstallComponent.cs
- DESCryptoServiceProvider.cs
- DeclarativeCatalogPart.cs
- AuthenticationModulesSection.cs
- DNS.cs
- VisualBasicValue.cs
- QueryContinueDragEvent.cs
- ManualResetEvent.cs
- Stylesheet.cs
- TextMessageEncodingElement.cs
- PromptStyle.cs
- FormsAuthenticationEventArgs.cs
- XmlSchemaElement.cs
- EventArgs.cs
- BackgroundWorker.cs
- AsymmetricKeyExchangeFormatter.cs
- KeyValuePairs.cs
- ProtocolImporter.cs
- Point4D.cs
- PostBackTrigger.cs
- QuaternionRotation3D.cs
- ProfileSettingsCollection.cs
- RefExpr.cs
- IERequestCache.cs
- BufferedStream.cs
- CustomPopupPlacement.cs
- AssemblyNameUtility.cs
- CapabilitiesAssignment.cs
- BasicHttpMessageSecurityElement.cs
- KeyPressEvent.cs
- XXXInfos.cs
- PictureBox.cs
- SecurityKeyEntropyMode.cs
- ScriptIgnoreAttribute.cs
- ShaperBuffers.cs
- AttributeUsageAttribute.cs
- PropertyChangeTracker.cs
- ComAdminInterfaces.cs
- AttributeCollection.cs
- CompositionTarget.cs
- _Rfc2616CacheValidators.cs
- Image.cs
- SelectionChangedEventArgs.cs
- TransformerTypeCollection.cs
- DocumentReference.cs
- DSASignatureFormatter.cs
- XmlComment.cs
- ProcessHostServerConfig.cs
- MulticastDelegate.cs
- AuditLog.cs
- DetailsViewUpdateEventArgs.cs
- WebReferencesBuildProvider.cs
- ImageIndexConverter.cs
- BitmapEffectOutputConnector.cs
- PageVisual.cs
- WebHttpBinding.cs
- DataGridTablesFactory.cs
- SafeThemeHandle.cs
- DataFormats.cs
- CheckBoxStandardAdapter.cs
- RightsManagementInformation.cs
- IEnumerable.cs
- TemplateApplicationHelper.cs
- MediaContextNotificationWindow.cs
- PersonalizationStateInfo.cs
- WSSecureConversation.cs
- ContextMenu.cs
- IisTraceListener.cs
- XmlILAnnotation.cs
- MetaForeignKeyColumn.cs
- DirectoryGroupQuery.cs
- SqlTriggerContext.cs
- HashHelper.cs
- _LocalDataStore.cs
- XmlRawWriterWrapper.cs
- DocumentViewerAutomationPeer.cs
- WebPartMinimizeVerb.cs
- httpserverutility.cs
- WebPartDeleteVerb.cs
- altserialization.cs
- PerfService.cs
- DispatcherHookEventArgs.cs
- streamingZipPartStream.cs
- DuplexChannel.cs
- BaseProcessor.cs