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
- GridSplitterAutomationPeer.cs
- DataGridViewComboBoxEditingControl.cs
- TypefaceMetricsCache.cs
- SqlInternalConnectionSmi.cs
- Translator.cs
- FormParameter.cs
- QueryContinueDragEventArgs.cs
- ViewKeyConstraint.cs
- EnumDataContract.cs
- InvalidWMPVersionException.cs
- Point3DCollectionConverter.cs
- Stacktrace.cs
- PeerResolver.cs
- XmlnsPrefixAttribute.cs
- ContentControl.cs
- CornerRadiusConverter.cs
- LineVisual.cs
- KeyPullup.cs
- DataGridViewCellMouseEventArgs.cs
- XPathAxisIterator.cs
- clipboard.cs
- BindableTemplateBuilder.cs
- AuthorizationSection.cs
- FontSizeConverter.cs
- TimerElapsedEvenArgs.cs
- ServiceDebugElement.cs
- WindowsFormsLinkLabel.cs
- FirstMatchCodeGroup.cs
- BamlWriter.cs
- PromptBuilder.cs
- UrlParameterWriter.cs
- COMException.cs
- ValueTypeIndexerReference.cs
- MobileErrorInfo.cs
- path.cs
- SolidColorBrush.cs
- SafeFileMapViewHandle.cs
- EventMappingSettings.cs
- TimelineClockCollection.cs
- MemoryStream.cs
- MobilePage.cs
- XmlSchemaNotation.cs
- XmlSchemaDocumentation.cs
- ReaderOutput.cs
- MediaContextNotificationWindow.cs
- ColumnResizeAdorner.cs
- StringExpressionSet.cs
- DesignerOptionService.cs
- DocumentProperties.cs
- BaseServiceProvider.cs
- DataConnectionHelper.cs
- ProjectionCamera.cs
- ServerValidateEventArgs.cs
- ISAPIWorkerRequest.cs
- StrokeNodeData.cs
- ExtensionSimplifierMarkupObject.cs
- ClientBuildManager.cs
- Attributes.cs
- FormViewCommandEventArgs.cs
- SiteMapNodeItemEventArgs.cs
- SafeFileMapViewHandle.cs
- FrameworkObject.cs
- HashSetEqualityComparer.cs
- DatagridviewDisplayedBandsData.cs
- WindowsGraphics.cs
- CssTextWriter.cs
- CrossContextChannel.cs
- RangeBase.cs
- DataGridBoolColumn.cs
- AuthenticationSchemesHelper.cs
- SamlAuthenticationStatement.cs
- SamlAuthenticationClaimResource.cs
- ChtmlSelectionListAdapter.cs
- DataViewManagerListItemTypeDescriptor.cs
- ConsumerConnectionPointCollection.cs
- FormsAuthenticationCredentials.cs
- TextTreeUndo.cs
- TimelineClockCollection.cs
- CacheRequest.cs
- CancellationScope.cs
- GreenMethods.cs
- CapabilitiesAssignment.cs
- WindowsAuthenticationEventArgs.cs
- BasicKeyConstraint.cs
- Error.cs
- SectionUpdates.cs
- GACMembershipCondition.cs
- StrokeNodeEnumerator.cs
- BookmarkList.cs
- InvalidWMPVersionException.cs
- Highlights.cs
- ISCIIEncoding.cs
- CompilerError.cs
- TextEffectResolver.cs
- RegexFCD.cs
- DescendantBaseQuery.cs
- OleDbFactory.cs
- MulticastOption.cs
- WpfWebRequestHelper.cs
- NonBatchDirectoryCompiler.cs