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
- DataTableNewRowEvent.cs
- MulticastDelegate.cs
- CachingHintValidation.cs
- _DisconnectOverlappedAsyncResult.cs
- ArrayElementGridEntry.cs
- NavigationEventArgs.cs
- ScriptingRoleServiceSection.cs
- FlowchartDesignerCommands.cs
- TileBrush.cs
- SoapElementAttribute.cs
- TransformPatternIdentifiers.cs
- TextWriterEngine.cs
- EncoderParameters.cs
- ComAdminInterfaces.cs
- WebContext.cs
- MaskInputRejectedEventArgs.cs
- CodeMethodReturnStatement.cs
- OptimizedTemplateContent.cs
- MouseOverProperty.cs
- SiteIdentityPermission.cs
- SymmetricKeyWrap.cs
- DiagnosticTraceSource.cs
- GPStream.cs
- DBSchemaTable.cs
- FastEncoder.cs
- compensatingcollection.cs
- Size3DValueSerializer.cs
- TaskHelper.cs
- InternalMappingException.cs
- Subset.cs
- Container.cs
- DateTimeAutomationPeer.cs
- AssertValidation.cs
- RotateTransform.cs
- ProxyWebPartConnectionCollection.cs
- XsltConvert.cs
- UnsafeNativeMethods.cs
- ToolStripSeparatorRenderEventArgs.cs
- SimpleBitVector32.cs
- OleDbRowUpdatingEvent.cs
- XPathDescendantIterator.cs
- CanonicalFontFamilyReference.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- Solver.cs
- XappLauncher.cs
- ExpressionBuilder.cs
- AbandonedMutexException.cs
- ProgressPage.cs
- PieceNameHelper.cs
- storepermission.cs
- SqlBuilder.cs
- ProxyHelper.cs
- ToolStripItemDesigner.cs
- XmlnsDictionary.cs
- compensatingcollection.cs
- SecurityCriticalDataForSet.cs
- JournalNavigationScope.cs
- PerfCounters.cs
- GridViewColumnCollection.cs
- ReachFixedPageSerializer.cs
- UnsafeNativeMethodsPenimc.cs
- RowVisual.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- xdrvalidator.cs
- EditCommandColumn.cs
- PropertyMapper.cs
- CalculatedColumn.cs
- TableStyle.cs
- WebPartManagerInternals.cs
- Privilege.cs
- Lease.cs
- _SslSessionsCache.cs
- CategoryGridEntry.cs
- SqlEnums.cs
- WebPartDescription.cs
- sqlpipe.cs
- TemplatePartAttribute.cs
- SoapRpcMethodAttribute.cs
- TextTreeRootNode.cs
- RoleManagerModule.cs
- List.cs
- TextUtf8RawTextWriter.cs
- CodeAttributeDeclaration.cs
- SharedPerformanceCounter.cs
- PermissionSetTriple.cs
- ResourceIDHelper.cs
- EUCJPEncoding.cs
- XmlLanguage.cs
- ChameleonKey.cs
- XmlRawWriter.cs
- HwndAppCommandInputProvider.cs
- IISUnsafeMethods.cs
- PropertiesTab.cs
- RowToFieldTransformer.cs
- ProcessModule.cs
- TraceSwitch.cs
- SequenceNumber.cs
- XmlSchemaAnyAttribute.cs
- ServiceDescription.cs
- Cursors.cs