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
- Emitter.cs
- XPathAxisIterator.cs
- AuthenticationModuleElementCollection.cs
- SyndicationSerializer.cs
- FileVersion.cs
- ContextMenuAutomationPeer.cs
- AppDomainFactory.cs
- ExpressionWriter.cs
- NextPreviousPagerField.cs
- BaseCodePageEncoding.cs
- HttpCachePolicy.cs
- EncoderReplacementFallback.cs
- LocalizeDesigner.cs
- PolyLineSegment.cs
- BrowserCapabilitiesCodeGenerator.cs
- UIElementAutomationPeer.cs
- MemberHolder.cs
- DataListDesigner.cs
- SqlDataSourceConnectionPanel.cs
- CacheModeConverter.cs
- Authorization.cs
- RC2.cs
- BitmapData.cs
- FrameDimension.cs
- Message.cs
- ExpressionCopier.cs
- RegistryConfigurationProvider.cs
- Camera.cs
- EasingFunctionBase.cs
- httpapplicationstate.cs
- Mutex.cs
- WinFormsUtils.cs
- CachingHintValidation.cs
- SiteMapSection.cs
- WebBrowserNavigatingEventHandler.cs
- DataGridViewColumnHeaderCell.cs
- ScaleTransform.cs
- SafeLocalMemHandle.cs
- DependencyObjectType.cs
- ImageClickEventArgs.cs
- EntityContainerEmitter.cs
- ConfigXmlComment.cs
- TrackingRecord.cs
- TreeViewTemplateSelector.cs
- IdentityNotMappedException.cs
- TranslateTransform3D.cs
- InputElement.cs
- LinkButton.cs
- XsdValidatingReader.cs
- DelimitedListTraceListener.cs
- MsmqElementBase.cs
- PathFigure.cs
- UInt32Converter.cs
- Match.cs
- DefaultMergeHelper.cs
- SafeLibraryHandle.cs
- FlowPosition.cs
- ThreadBehavior.cs
- ReadOnlyCollectionBase.cs
- DomNameTable.cs
- ConvertBinder.cs
- Lasso.cs
- GeneralTransform3DTo2DTo3D.cs
- FormParameter.cs
- Vector3D.cs
- UnsafeNativeMethods.cs
- Collection.cs
- BindingMemberInfo.cs
- ReadOnlyCollection.cs
- Trigger.cs
- ContextActivityUtils.cs
- DataControlLinkButton.cs
- GridViewDeletedEventArgs.cs
- DataGridViewImageCell.cs
- ListChangedEventArgs.cs
- KeyedCollection.cs
- FormsAuthenticationTicket.cs
- FirewallWrapper.cs
- LightweightCodeGenerator.cs
- BitmapFrameEncode.cs
- ISessionStateStore.cs
- XmlSchemaExporter.cs
- MasterPage.cs
- BaseEntityWrapper.cs
- ManagementBaseObject.cs
- FlowDocument.cs
- GC.cs
- DesignerVerb.cs
- QueryAccessibilityHelpEvent.cs
- LinkClickEvent.cs
- mda.cs
- ChildTable.cs
- WindowsTab.cs
- GlyphRun.cs
- PixelFormats.cs
- ObjectTag.cs
- SystemNetworkInterface.cs
- MemberInfoSerializationHolder.cs
- DataGridViewRowEventArgs.cs
- SafeLibraryHandle.cs