Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / Configuration / serverconfig.cs / 3 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DbBuffer.cs
- ProjectionRewriter.cs
- PopOutPanel.cs
- GACIdentityPermission.cs
- SecurityDescriptor.cs
- FrameworkTemplate.cs
- NodeLabelEditEvent.cs
- HtmlTernaryTree.cs
- TextFormatterContext.cs
- AdCreatedEventArgs.cs
- OleDbRowUpdatedEvent.cs
- SignatureGenerator.cs
- MouseBinding.cs
- Figure.cs
- SplitterCancelEvent.cs
- ConfigXmlElement.cs
- DockingAttribute.cs
- XmlSchemaException.cs
- MethodExpression.cs
- ContainerActivationHelper.cs
- ScrollViewerAutomationPeer.cs
- OrthographicCamera.cs
- SplineKeyFrames.cs
- SpecialNameAttribute.cs
- WebPartEditorCancelVerb.cs
- FormClosedEvent.cs
- DataTableNameHandler.cs
- MessagePartProtectionMode.cs
- TextWriterEngine.cs
- BuildProvidersCompiler.cs
- PersonalizationState.cs
- UriTemplateDispatchFormatter.cs
- SemanticBasicElement.cs
- AdornerHitTestResult.cs
- _OverlappedAsyncResult.cs
- XmlValidatingReaderImpl.cs
- FontConverter.cs
- SendAgentStatusRequest.cs
- RowCache.cs
- HandlerMappingMemo.cs
- CustomPopupPlacement.cs
- ImageField.cs
- GridPatternIdentifiers.cs
- HeaderedContentControl.cs
- ExpressionEvaluator.cs
- PrinterResolution.cs
- InternalRelationshipCollection.cs
- Attributes.cs
- CheckBoxStandardAdapter.cs
- MailMessageEventArgs.cs
- CollaborationHelperFunctions.cs
- SafeMarshalContext.cs
- FileChangesMonitor.cs
- AssociationEndMember.cs
- SessionStateSection.cs
- OptionUsage.cs
- WaveHeader.cs
- BaseTreeIterator.cs
- VerificationException.cs
- UntypedNullExpression.cs
- ComponentManagerBroker.cs
- OrderByQueryOptionExpression.cs
- WindowsRichEdit.cs
- PersistChildrenAttribute.cs
- Image.cs
- SafeLocalMemHandle.cs
- DbConnectionFactory.cs
- LayoutEngine.cs
- TimeSpanStorage.cs
- RowToFieldTransformer.cs
- CallbackTimeoutsBehavior.cs
- SystemIPv4InterfaceProperties.cs
- TreeNodeConverter.cs
- HttpRuntime.cs
- ButtonBaseAutomationPeer.cs
- ListQueryResults.cs
- CompareValidator.cs
- TreeBuilderBamlTranslator.cs
- PathSegmentCollection.cs
- SafeNativeMethodsOther.cs
- DeclarativeCatalogPartDesigner.cs
- CmsInterop.cs
- RuntimeWrappedException.cs
- StorageEndPropertyMapping.cs
- IncrementalReadDecoders.cs
- EntryWrittenEventArgs.cs
- WebPartTransformerCollection.cs
- XmlSignatureProperties.cs
- DictionarySectionHandler.cs
- MediaElementAutomationPeer.cs
- WasAdminWrapper.cs
- _NegotiateClient.cs
- TimeoutException.cs
- FatalException.cs
- XmlEncoding.cs
- TypeDefinition.cs
- PageAdapter.cs
- AdapterUtil.cs
- TextTreeNode.cs
- NotifyIcon.cs