Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / Configuration / serverconfig.cs / 4 / 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; } } } }
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CssStyleCollection.cs
- KeyPressEvent.cs
- CornerRadius.cs
- XsltCompileContext.cs
- RawAppCommandInputReport.cs
- DataReaderContainer.cs
- HebrewCalendar.cs
- ExpressionBuilderContext.cs
- BindingBase.cs
- Security.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- TextEditorLists.cs
- Span.cs
- CustomPopupPlacement.cs
- TypedTableBase.cs
- GridViewRowPresenter.cs
- MetadataCache.cs
- DetailsViewRowCollection.cs
- PageScaling.cs
- ChannelFactoryBase.cs
- EventsTab.cs
- FontSource.cs
- processwaithandle.cs
- LayoutDump.cs
- ToolStripContainerActionList.cs
- Int16AnimationUsingKeyFrames.cs
- SubpageParagraph.cs
- ElementNotAvailableException.cs
- _AcceptOverlappedAsyncResult.cs
- ArgumentValue.cs
- TypeBuilderInstantiation.cs
- Rect3D.cs
- TextContainerHelper.cs
- NegationPusher.cs
- LineInfo.cs
- ViewUtilities.cs
- CurrentTimeZone.cs
- _AuthenticationState.cs
- FormViewPagerRow.cs
- SerializationObjectManager.cs
- JpegBitmapDecoder.cs
- PackageRelationshipSelector.cs
- TemplateControl.cs
- Transform3D.cs
- RelatedView.cs
- TemplateColumn.cs
- TextTreeTextElementNode.cs
- StateManagedCollection.cs
- ElementNotEnabledException.cs
- XsltException.cs
- X500Name.cs
- GlyphCache.cs
- XPathNode.cs
- QilValidationVisitor.cs
- XsltQilFactory.cs
- PcmConverter.cs
- BeginGetFileNameFromUserRequest.cs
- EndGetFileNameFromUserRequest.cs
- FormViewUpdatedEventArgs.cs
- BinaryNode.cs
- XmlAttributeHolder.cs
- DataGridViewRowsRemovedEventArgs.cs
- CriticalHandle.cs
- Compress.cs
- InputScopeNameConverter.cs
- RawAppCommandInputReport.cs
- RuntimeHandles.cs
- SqlInfoMessageEvent.cs
- MimeTypeMapper.cs
- FileDialogPermission.cs
- OutputCacheSettingsSection.cs
- ColumnMapProcessor.cs
- RuleDefinitions.cs
- ScrollPattern.cs
- DataBoundControlAdapter.cs
- TextCollapsingProperties.cs
- ReachFixedDocumentSerializer.cs
- _SslState.cs
- SByteStorage.cs
- KerberosRequestorSecurityToken.cs
- AspNetPartialTrustHelpers.cs
- TextServicesHost.cs
- mansign.cs
- PropertyFilterAttribute.cs
- UnsafeNativeMethodsMilCoreApi.cs
- TdsParserStaticMethods.cs
- CompilationLock.cs
- Quaternion.cs
- PackageProperties.cs
- PropertyTab.cs
- CommandArguments.cs
- GenericEnumerator.cs
- FixedStringLookup.cs
- SizeChangedEventArgs.cs
- Itemizer.cs
- TimeSpanValidator.cs
- MessageQueueKey.cs
- ProfileSettingsCollection.cs
- MetabaseReader.cs
- TrackingAnnotationCollection.cs