Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / xsp / System / Web / Configuration / serverconfig.cs / 1 / serverconfig.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System.Configuration; using System.Collections; using System.Globalization; using System.Text; using System.Threading; using System.Web.Util; using System.Web.Hosting; using System.Web.Caching; using System.Web.Compilation; using Microsoft.Win32; // // Abstracts differences between config retreived from IIS 6 metabase // and config retreived from new IIS7 configuration system. // static internal class ServerConfig { static int s_iisMajorVersion = 0; internal static bool UseMetabase { get { if (s_iisMajorVersion == 0) { int version; try { object ver = Registry.GetValue("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\InetStp", "MajorVersion", 0); version = (ver != null) ? (int) ver : -1; } catch (ArgumentException) { // Ignore ArgumentException from Registry.GetValue. This may indicate that the key does not exist, i.e. IIS not installed version = -1; // Key not found } Interlocked.CompareExchange(ref s_iisMajorVersion, version, 0); } return s_iisMajorVersion <= 6; } } static internal IServerConfig GetInstance() { // IIS 7 bits on <= IIS 6: use the metabase if (UseMetabase) { return MetabaseServerConfig.GetInstance(); } return ProcessHostServerConfig.GetInstance(); } // // Return true in cases where web server configuration should be used // to resolve paths. // static int s_useServerConfig = -1; static internal bool UseServerConfig { get { if (s_useServerConfig == -1) { int useServerConfig = 0; // Must use web server config if there is no hosting environment if (!HostingEnvironment.IsHosted) { useServerConfig = 1; } // Hosting environment is the web server else if (HostingEnvironment.ApplicationHost is ISAPIApplicationHost) { useServerConfig = 1; } // Hosting environment is the web server else if (HostingEnvironment.IsUnderIISProcess && !BuildManagerHost.InClientBuildManager) { useServerConfig = 1; } Interlocked.CompareExchange(ref s_useServerConfig, useServerConfig, -1); } return s_useServerConfig == 1; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System.Configuration; using System.Collections; using System.Globalization; using System.Text; using System.Threading; using System.Web.Util; using System.Web.Hosting; using System.Web.Caching; using System.Web.Compilation; using Microsoft.Win32; // // Abstracts differences between config retreived from IIS 6 metabase // and config retreived from new IIS7 configuration system. // static internal class ServerConfig { static int s_iisMajorVersion = 0; internal static bool UseMetabase { get { if (s_iisMajorVersion == 0) { int version; try { object ver = Registry.GetValue("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\InetStp", "MajorVersion", 0); version = (ver != null) ? (int) ver : -1; } catch (ArgumentException) { // Ignore ArgumentException from Registry.GetValue. This may indicate that the key does not exist, i.e. IIS not installed version = -1; // Key not found } Interlocked.CompareExchange(ref s_iisMajorVersion, version, 0); } return s_iisMajorVersion <= 6; } } static internal IServerConfig GetInstance() { // IIS 7 bits on <= IIS 6: use the metabase if (UseMetabase) { return MetabaseServerConfig.GetInstance(); } return ProcessHostServerConfig.GetInstance(); } // // Return true in cases where web server configuration should be used // to resolve paths. // static int s_useServerConfig = -1; static internal bool UseServerConfig { get { if (s_useServerConfig == -1) { int useServerConfig = 0; // Must use web server config if there is no hosting environment if (!HostingEnvironment.IsHosted) { useServerConfig = 1; } // Hosting environment is the web server else if (HostingEnvironment.ApplicationHost is ISAPIApplicationHost) { useServerConfig = 1; } // Hosting environment is the web server else if (HostingEnvironment.IsUnderIISProcess && !BuildManagerHost.InClientBuildManager) { useServerConfig = 1; } Interlocked.CompareExchange(ref s_useServerConfig, useServerConfig, -1); } return s_useServerConfig == 1; } } } } // 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
- RawStylusActions.cs
- TemplatePropertyEntry.cs
- IUnknownConstantAttribute.cs
- InternalResources.cs
- EntityCommand.cs
- WebConfigManager.cs
- ObservableCollection.cs
- CompressStream.cs
- RichTextBoxContextMenu.cs
- AppDomainUnloadedException.cs
- IndentedWriter.cs
- Codec.cs
- ConstraintConverter.cs
- CaseKeyBox.ViewModel.cs
- XPathArrayIterator.cs
- BadImageFormatException.cs
- EdmComplexPropertyAttribute.cs
- EmissiveMaterial.cs
- WindowsScrollBar.cs
- TabletDeviceInfo.cs
- TypeNameConverter.cs
- DataDocumentXPathNavigator.cs
- StyleHelper.cs
- ConnectorSelectionGlyph.cs
- ManagedWndProcTracker.cs
- SAPICategories.cs
- EventWaitHandle.cs
- TrustLevel.cs
- Annotation.cs
- MembershipValidatePasswordEventArgs.cs
- QueryStringParameter.cs
- SamlAttribute.cs
- DataTableTypeConverter.cs
- counter.cs
- UriTemplateTrieNode.cs
- IssuanceLicense.cs
- CommandField.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- PrintController.cs
- PageParser.cs
- EntityDataSourceChangingEventArgs.cs
- TextTreeInsertUndoUnit.cs
- TextOnlyOutput.cs
- NativeCompoundFileAPIs.cs
- StylusPlugInCollection.cs
- ScriptResourceHandler.cs
- CreateUserWizardDesigner.cs
- LabelEditEvent.cs
- Sql8ExpressionRewriter.cs
- SafeViewOfFileHandle.cs
- AnimationTimeline.cs
- TextBoxRenderer.cs
- KeyConverter.cs
- ToolStripComboBox.cs
- TextEffectCollection.cs
- QueryOpeningEnumerator.cs
- RepeatButton.cs
- SqlBinder.cs
- Opcode.cs
- BrowserPolicyValidator.cs
- OutputWindow.cs
- CertificateManager.cs
- XmlTextReaderImpl.cs
- LostFocusEventManager.cs
- DataGridViewComboBoxEditingControl.cs
- UpDownEvent.cs
- wpf-etw.cs
- RemotingConfigParser.cs
- EndpointDiscoveryElement.cs
- HostingEnvironment.cs
- WorkflowDebuggerSteppingAttribute.cs
- TypeSource.cs
- BaseCollection.cs
- TraceHandler.cs
- ListSourceHelper.cs
- ColorKeyFrameCollection.cs
- SimpleExpression.cs
- ScrollBarAutomationPeer.cs
- ADConnectionHelper.cs
- WorkflowEventArgs.cs
- PingReply.cs
- InvalidateEvent.cs
- XmlDictionaryWriter.cs
- UITypeEditors.cs
- UntypedNullExpression.cs
- DetailsViewInsertedEventArgs.cs
- TextDecorationCollection.cs
- UriSectionData.cs
- XmlName.cs
- RemoteWebConfigurationHostServer.cs
- Activation.cs
- DataRow.cs
- ListDictionary.cs
- PKCS1MaskGenerationMethod.cs
- SessionStateUtil.cs
- CodeTypeReference.cs
- TypeConverterMarkupExtension.cs
- ErrorProvider.cs
- WindowsBrush.cs
- FontSourceCollection.cs