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
- EmptyQuery.cs
- GenericQueueSurrogate.cs
- LZCodec.cs
- DataGridLength.cs
- EventLogConfiguration.cs
- DispatchChannelSink.cs
- TrackingServices.cs
- TdsValueSetter.cs
- WindowsListBox.cs
- EventlogProvider.cs
- XmlNodeChangedEventManager.cs
- EncryptedData.cs
- ColorConverter.cs
- RegistryKey.cs
- CodeEventReferenceExpression.cs
- SingleAnimation.cs
- XpsS0ValidatingLoader.cs
- EmptyArray.cs
- DataGridItemEventArgs.cs
- NamespaceInfo.cs
- JsonStringDataContract.cs
- MdiWindowListStrip.cs
- EditorResources.cs
- DescendentsWalkerBase.cs
- SqlXml.cs
- DataGridToolTip.cs
- AdRotator.cs
- SQLInt32.cs
- log.cs
- ControlSerializer.cs
- KerberosSecurityTokenAuthenticator.cs
- LinqMaximalSubtreeNominator.cs
- BaseCodePageEncoding.cs
- UnregisterInfo.cs
- RowToFieldTransformer.cs
- WindowsGrip.cs
- HScrollProperties.cs
- NativeMethods.cs
- HiddenFieldPageStatePersister.cs
- FastPropertyAccessor.cs
- SettingsProperty.cs
- AuthorizationPolicyTypeElement.cs
- SqlDataRecord.cs
- ImageListStreamer.cs
- FixedTextPointer.cs
- CodeArgumentReferenceExpression.cs
- AggregateNode.cs
- ByteStreamGeometryContext.cs
- QilGeneratorEnv.cs
- XslAst.cs
- ToolStripInSituService.cs
- ResXDataNode.cs
- DescendantOverDescendantQuery.cs
- FunctionNode.cs
- TrustManager.cs
- DocumentPropertiesDialog.cs
- PnrpPeerResolver.cs
- ToolStrip.cs
- ViewEvent.cs
- HitTestParameters.cs
- Hash.cs
- Attributes.cs
- CodeCompiler.cs
- HwndSource.cs
- CryptoConfig.cs
- TransactionBridge.cs
- TextSyndicationContent.cs
- UrlAuthFailedErrorFormatter.cs
- NamespaceInfo.cs
- InArgumentConverter.cs
- HandledMouseEvent.cs
- XmlSchemaObject.cs
- FixedStringLookup.cs
- ContentPosition.cs
- RequestSecurityTokenResponse.cs
- XslAst.cs
- ImageDrawing.cs
- StyleModeStack.cs
- SignedInfo.cs
- SqlUnionizer.cs
- LayeredChannelFactory.cs
- PartManifestEntry.cs
- CodeDomConfigurationHandler.cs
- TraceInternal.cs
- TemplatePropertyEntry.cs
- SystemTcpConnection.cs
- DetailsViewModeEventArgs.cs
- SystemIPv4InterfaceProperties.cs
- HttpFormatExtensions.cs
- JavaScriptObjectDeserializer.cs
- RowSpanVector.cs
- BatchParser.cs
- RawStylusInputReport.cs
- Relationship.cs
- Size.cs
- ContentFilePart.cs
- RoleManagerEventArgs.cs
- TableCell.cs
- HttpModuleCollection.cs
- AbstractSvcMapFileLoader.cs