Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Configuration / ImpersonateTokenRef.cs / 1305376 / ImpersonateTokenRef.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; using System.Web.Util; using System.Web.Configuration; // class IdentitySection internal sealed class ImpersonateTokenRef : IDisposable { private IntPtr _handle; internal ImpersonateTokenRef(IntPtr token) { _handle = token; } internal IntPtr Handle { get { return _handle; } } // The handle can be kept alive by HttpContext.s_appIdentityConfig (see ASURT#121815) ~ImpersonateTokenRef() { if (_handle != IntPtr.Zero) { UnsafeNativeMethods.CloseHandle(_handle); _handle = IntPtr.Zero; } } void IDisposable.Dispose() { if (_handle != IntPtr.Zero) { UnsafeNativeMethods.CloseHandle(_handle); _handle = IntPtr.Zero; } GC.SuppressFinalize(this); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Configuration { using System; using System.Xml; using System.Configuration; using System.Collections.Specialized; using System.Collections; using System.IO; using System.Text; using System.Web.Util; using System.Web.Configuration; // class IdentitySection internal sealed class ImpersonateTokenRef : IDisposable { private IntPtr _handle; internal ImpersonateTokenRef(IntPtr token) { _handle = token; } internal IntPtr Handle { get { return _handle; } } // The handle can be kept alive by HttpContext.s_appIdentityConfig (see ASURT#121815) ~ImpersonateTokenRef() { if (_handle != IntPtr.Zero) { UnsafeNativeMethods.CloseHandle(_handle); _handle = IntPtr.Zero; } } void IDisposable.Dispose() { if (_handle != IntPtr.Zero) { UnsafeNativeMethods.CloseHandle(_handle); _handle = IntPtr.Zero; } GC.SuppressFinalize(this); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FilteredXmlReader.cs
- SmtpSection.cs
- TextTreePropertyUndoUnit.cs
- SrgsNameValueTag.cs
- ProfileProvider.cs
- TextView.cs
- CipherData.cs
- SoapExtensionTypeElement.cs
- WebServiceClientProxyGenerator.cs
- SqlFacetAttribute.cs
- IntMinMaxAggregationOperator.cs
- AvTraceDetails.cs
- InputBuffer.cs
- LambdaCompiler.Binary.cs
- TrustManager.cs
- DefaultPropertyAttribute.cs
- Accessible.cs
- TextTreeFixupNode.cs
- TrackingExtract.cs
- XmlDocumentType.cs
- ResourceExpressionEditor.cs
- MessageHeaderInfoTraceRecord.cs
- DataGridViewDataErrorEventArgs.cs
- HandlerBase.cs
- XPathNodeHelper.cs
- MatrixTransform3D.cs
- Command.cs
- DbInsertCommandTree.cs
- DiffuseMaterial.cs
- TimeSpanMinutesConverter.cs
- RectAnimationBase.cs
- AuthenticationSection.cs
- BitmapEffectInput.cs
- ItemAutomationPeer.cs
- HierarchicalDataBoundControl.cs
- UniqueEventHelper.cs
- WindowsPrincipal.cs
- ListView.cs
- SerializationEventsCache.cs
- HwndHostAutomationPeer.cs
- PenThreadWorker.cs
- TableLayoutColumnStyleCollection.cs
- WebPartAuthorizationEventArgs.cs
- BamlWriter.cs
- SpellerStatusTable.cs
- SearchForVirtualItemEventArgs.cs
- NameTable.cs
- Constraint.cs
- NativeMethods.cs
- ConfigurationStrings.cs
- DBSqlParserTable.cs
- QueryContinueDragEvent.cs
- WebScriptClientGenerator.cs
- XmlQualifiedName.cs
- TimeSpanValidatorAttribute.cs
- ColorTransform.cs
- HtmlTableCell.cs
- FilteredReadOnlyMetadataCollection.cs
- CuspData.cs
- MemoryStream.cs
- MessageDesigner.cs
- EncoderBestFitFallback.cs
- ConfigurationLocationCollection.cs
- XmlEncoding.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- InputLanguageProfileNotifySink.cs
- DataMisalignedException.cs
- TrackingRecord.cs
- Label.cs
- PackageProperties.cs
- ClientTargetCollection.cs
- ContextMenuAutomationPeer.cs
- FixedTextPointer.cs
- NullReferenceException.cs
- XmlSchemaAnyAttribute.cs
- DefaultAsyncDataDispatcher.cs
- EncoderParameters.cs
- ServicePointManagerElement.cs
- OperatingSystem.cs
- EnumerableCollectionView.cs
- Calendar.cs
- _SSPIWrapper.cs
- ConnectionStringsExpressionBuilder.cs
- PageCatalogPart.cs
- FixedSOMTableRow.cs
- HttpApplication.cs
- DbConnectionPoolIdentity.cs
- CircleHotSpot.cs
- MultilineStringEditor.cs
- UnicodeEncoding.cs
- WindowAutomationPeer.cs
- InheritedPropertyChangedEventArgs.cs
- WebEvents.cs
- TargetConverter.cs
- SecurityDocument.cs
- MsmqProcessProtocolHandler.cs
- OperationGenerator.cs
- TableColumnCollectionInternal.cs
- UInt16Storage.cs
- ReadOnlyDataSourceView.cs