Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- Section.cs
- RegexGroup.cs
- TaskForm.cs
- PolicyStatement.cs
- SourceFileBuildProvider.cs
- ToggleButton.cs
- VarRefManager.cs
- Part.cs
- DiscoveryEndpointElement.cs
- DynamicVirtualDiscoSearcher.cs
- ResourceReader.cs
- LiteralControl.cs
- IgnoreSectionHandler.cs
- And.cs
- ToolStripSplitStackLayout.cs
- MonthChangedEventArgs.cs
- TextSchema.cs
- RequestSecurityTokenResponseCollection.cs
- ChtmlCommandAdapter.cs
- WebPartCancelEventArgs.cs
- RankException.cs
- PaginationProgressEventArgs.cs
- FormViewActionList.cs
- FacetChecker.cs
- RelationalExpressions.cs
- GridViewColumn.cs
- TransformProviderWrapper.cs
- ErrorFormatter.cs
- XslNumber.cs
- WebSysDisplayNameAttribute.cs
- UpdateException.cs
- XslCompiledTransform.cs
- OracleCommand.cs
- CompatibleIComparer.cs
- EmptyQuery.cs
- BufferedGraphicsContext.cs
- EntityUtil.cs
- ProbeDuplexCD1AsyncResult.cs
- TypeUtil.cs
- MenuBase.cs
- SystemIcons.cs
- listitem.cs
- BoundColumn.cs
- RemoteCryptoDecryptRequest.cs
- SafeIUnknown.cs
- QueryPageSettingsEventArgs.cs
- ApplicationFileCodeDomTreeGenerator.cs
- WorkflowInvoker.cs
- SemaphoreFullException.cs
- ScrollPattern.cs
- ListViewGroupConverter.cs
- GeometryDrawing.cs
- Matrix.cs
- SqlWebEventProvider.cs
- OleDbConnection.cs
- _BaseOverlappedAsyncResult.cs
- EnumType.cs
- WhitespaceRuleLookup.cs
- __Filters.cs
- XmlProcessingInstruction.cs
- TogglePattern.cs
- RichTextBox.cs
- ActivityBindForm.cs
- ItemsChangedEventArgs.cs
- HyperLinkDataBindingHandler.cs
- ResXDataNode.cs
- CoreSwitches.cs
- SettingsSection.cs
- SBCSCodePageEncoding.cs
- PlatformCulture.cs
- CommonProperties.cs
- DBPropSet.cs
- GradientBrush.cs
- HtmlTextArea.cs
- GrammarBuilderDictation.cs
- MultiPageTextView.cs
- SQLByteStorage.cs
- SqlNotificationRequest.cs
- UInt16Storage.cs
- BeginStoryboard.cs
- ExtendedProperty.cs
- SQLBytesStorage.cs
- RawStylusSystemGestureInputReport.cs
- BamlVersionHeader.cs
- HyperLink.cs
- LogLogRecordHeader.cs
- CustomDictionarySources.cs
- GroupBox.cs
- ApplicationInfo.cs
- AssemblyBuilder.cs
- ValueTypeFixupInfo.cs
- TextFormatterContext.cs
- ProcessProtocolHandler.cs
- CompiledIdentityConstraint.cs
- ChtmlMobileTextWriter.cs
- MD5CryptoServiceProvider.cs
- CardSpaceException.cs
- BindableTemplateBuilder.cs
- WebExceptionStatus.cs
- basevalidator.cs