Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / Configuration / ImpersonateTokenRef.cs / 1 / 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.
//------------------------------------------------------------------------------
//
// 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProcessHost.cs
- Drawing.cs
- InfoCardTraceRecord.cs
- EntityDataSourceSelectedEventArgs.cs
- ServiceHttpHandlerFactory.cs
- ReadWriteSpinLock.cs
- FaultDescription.cs
- DoubleAnimationBase.cs
- Collection.cs
- CompositeDataBoundControl.cs
- TextBoxView.cs
- ErrorWebPart.cs
- ButtonBaseAutomationPeer.cs
- SafeSecurityHandles.cs
- IndicShape.cs
- CollectionContainer.cs
- ComAdminInterfaces.cs
- IntSecurity.cs
- TextSelectionHelper.cs
- HashCodeCombiner.cs
- PreviewKeyDownEventArgs.cs
- XslTransform.cs
- TemplateManager.cs
- PolicyStatement.cs
- SoundPlayerAction.cs
- DesignObjectWrapper.cs
- FlowDocumentPaginator.cs
- SystemIPv4InterfaceProperties.cs
- ToolStripItemTextRenderEventArgs.cs
- StreamWithDictionary.cs
- MouseActionConverter.cs
- DBAsyncResult.cs
- DrawingCollection.cs
- WmfPlaceableFileHeader.cs
- ParserContext.cs
- GridViewColumnCollectionChangedEventArgs.cs
- TraceHandlerErrorFormatter.cs
- CodeEntryPointMethod.cs
- figurelength.cs
- Camera.cs
- ObjectSecurity.cs
- ObjectDataSourceView.cs
- CodeRegionDirective.cs
- TabControl.cs
- ProtocolsConfigurationEntry.cs
- FontStyle.cs
- TextTreeTextNode.cs
- DynamicPhysicalDiscoSearcher.cs
- SuppressIldasmAttribute.cs
- ExpandoClass.cs
- ControlBuilder.cs
- FtpCachePolicyElement.cs
- ObjectTokenCategory.cs
- ParamArrayAttribute.cs
- PolicyValidationException.cs
- AutomationPropertyInfo.cs
- Floater.cs
- CalendarDay.cs
- SqlUserDefinedAggregateAttribute.cs
- _UncName.cs
- sqlmetadatafactory.cs
- DataGridViewImageCell.cs
- safelinkcollection.cs
- ZipIOExtraFieldZip64Element.cs
- SiteMapNode.cs
- HandleCollector.cs
- ITextView.cs
- SoapFault.cs
- ConfigurationManager.cs
- ObjectDataSourceMethodEventArgs.cs
- QilFactory.cs
- WindowsSolidBrush.cs
- InkPresenter.cs
- WebServiceErrorEvent.cs
- CreateInstanceBinder.cs
- StringExpressionSet.cs
- VisualProxy.cs
- EntityContainerEmitter.cs
- SourceFilter.cs
- WmiPutTraceRecord.cs
- CodePageUtils.cs
- InkCollectionBehavior.cs
- UIElement3DAutomationPeer.cs
- BitmapSourceSafeMILHandle.cs
- ProfileEventArgs.cs
- PixelFormatConverter.cs
- ProfileSettings.cs
- DataGridViewSelectedCellCollection.cs
- SHA384.cs
- SecurityTokenContainer.cs
- ADMembershipProvider.cs
- GeometryGroup.cs
- ProfessionalColors.cs
- DoubleStorage.cs
- SqlException.cs
- IteratorDescriptor.cs
- RuntimeArgumentHandle.cs
- VScrollProperties.cs
- DefaultEventAttribute.cs
- ElementHostPropertyMap.cs