Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Activation / Iis7Helper.cs / 1 / Iis7Helper.cs
//---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------------------- namespace System.ServiceModel.Activation { using Microsoft.Win32; using System.Configuration; using System.Collections; using System.Security.Permissions; using System.Security; static class Iis7Helper { static int iisVersion; static bool isIis7; static Iis7Helper() { isIis7 = GetIsIis7(); } ////// Critical - uses SecurityCritical method to get version info from registry /// Safe - processes registry info into a safe bool for return /// [SecurityCritical, SecurityTreatAsSafe] static bool GetIsIis7() { iisVersion = -1; object majorVersion = UnsafeGetMajorVersionFromRegistry(); if (majorVersion != null && majorVersion.GetType().Equals(typeof(int))) { iisVersion = (int)majorVersion; } return iisVersion >= 7; } const string subKey = @"Software\Microsoft\InetSTP"; ////// Critical - asserts registry access to get a single value from the registry /// caller should not leak value /// [SecurityCritical] [RegistryPermission(SecurityAction.Assert, Read = @"HKEY_LOCAL_MACHINE\" + subKey)] static object UnsafeGetMajorVersionFromRegistry() { using (RegistryKey localMachine = Registry.LocalMachine) { using (RegistryKey versionKey = localMachine.OpenSubKey(subKey)) { return versionKey != null ? versionKey.GetValue("MajorVersion") : null; } } } internal static int IisVersion { get { return iisVersion; } } internal static bool IsIis7 { get { return isIis7; } } } } // 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
- SmiEventSink_DeferedProcessing.cs
- DbConnectionPoolOptions.cs
- DrawingVisualDrawingContext.cs
- Decoder.cs
- Size3D.cs
- ErrorLog.cs
- MessageQueuePermissionEntry.cs
- RichTextBoxAutomationPeer.cs
- DataSourceUtil.cs
- BitmapInitialize.cs
- ObjectConverter.cs
- ExpressionNode.cs
- SelectorAutomationPeer.cs
- BaseAppDomainProtocolHandler.cs
- DrawingCollection.cs
- HitTestResult.cs
- Vertex.cs
- InkCanvasAutomationPeer.cs
- ServicePoint.cs
- ImageSource.cs
- TagNameToTypeMapper.cs
- IPAddress.cs
- CreateUserErrorEventArgs.cs
- CodeTypeMemberCollection.cs
- Page.cs
- VariableQuery.cs
- ByteStreamGeometryContext.cs
- XmlEventCache.cs
- NameValueFileSectionHandler.cs
- DesignerDataTable.cs
- ObjectCloneHelper.cs
- Point.cs
- AliasedSlot.cs
- SQLDecimal.cs
- SessionSymmetricMessageSecurityProtocolFactory.cs
- SelectedDatesCollection.cs
- Visual3D.cs
- TimeoutException.cs
- Opcode.cs
- ExpandCollapseProviderWrapper.cs
- HttpRawResponse.cs
- ViewStateException.cs
- XamlWriter.cs
- IgnoreFileBuildProvider.cs
- TypeLibConverter.cs
- NCryptSafeHandles.cs
- WebPartCatalogCloseVerb.cs
- QueryParameter.cs
- ErrorStyle.cs
- CustomValidator.cs
- DayRenderEvent.cs
- ResourceReferenceExpressionConverter.cs
- AuthorizationRuleCollection.cs
- Enum.cs
- ActivationServices.cs
- LocalBuilder.cs
- EntityAdapter.cs
- XmlSignificantWhitespace.cs
- WebPartZone.cs
- EmptyElement.cs
- RTLAwareMessageBox.cs
- PublisherMembershipCondition.cs
- TraceListener.cs
- ActiveXHelper.cs
- UmAlQuraCalendar.cs
- HorizontalAlignConverter.cs
- NameSpaceExtractor.cs
- ComboBoxAutomationPeer.cs
- InvalidStoreProtectionKeyException.cs
- X509RecipientCertificateClientElement.cs
- ErrorFormatter.cs
- CFStream.cs
- PrtTicket_Public.cs
- ApplicationDirectory.cs
- TCPListener.cs
- MergeFailedEvent.cs
- RegisteredHiddenField.cs
- ExternalException.cs
- XamlTreeBuilderBamlRecordWriter.cs
- MetabaseServerConfig.cs
- XmlIlGenerator.cs
- FacetValueContainer.cs
- BackStopAuthenticationModule.cs
- IdentityModelStringsVersion1.cs
- SqlUdtInfo.cs
- Expression.cs
- Util.cs
- GPRECT.cs
- SchemaType.cs
- StyleCollectionEditor.cs
- RootBrowserWindow.cs
- MethodInfo.cs
- AccessDataSource.cs
- PlatformNotSupportedException.cs
- ObjectDataProvider.cs
- StateInitializationDesigner.cs
- ContainerParaClient.cs
- Win32KeyboardDevice.cs
- RequiredFieldValidator.cs
- XmlSchemaComplexContentExtension.cs