Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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.
//
//-----------------------------------------------------------------------------
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
- LockCookie.cs
- MetadataWorkspace.cs
- CharEnumerator.cs
- CriticalHandle.cs
- OleDbPermission.cs
- HighContrastHelper.cs
- CounterCreationData.cs
- MobileControlsSection.cs
- XmlTextReaderImpl.cs
- XmlToDatasetMap.cs
- CodeTypeParameter.cs
- Char.cs
- PageParserFilter.cs
- IPAddressCollection.cs
- RectangleF.cs
- HttpDigestClientCredential.cs
- SqlCacheDependency.cs
- TrustLevel.cs
- CapabilitiesUse.cs
- CheckBoxList.cs
- UnsafeNativeMethodsMilCoreApi.cs
- EntityCommandDefinition.cs
- OracleString.cs
- XslAst.cs
- SiblingIterators.cs
- ComboBoxAutomationPeer.cs
- Currency.cs
- DbModificationCommandTree.cs
- TailCallAnalyzer.cs
- CookieParameter.cs
- AssemblyResourceLoader.cs
- XmlWrappingReader.cs
- SemaphoreFullException.cs
- Marshal.cs
- DataColumnMapping.cs
- DateTimeUtil.cs
- DbXmlEnabledProviderManifest.cs
- SafeNativeMethods.cs
- BindingExpression.cs
- SubMenuStyleCollection.cs
- FormsAuthenticationTicket.cs
- DataBindingExpressionBuilder.cs
- TdsParameterSetter.cs
- ArrangedElement.cs
- BindingEditor.xaml.cs
- PermissionRequestEvidence.cs
- SchemaCollectionPreprocessor.cs
- SqlUnionizer.cs
- UnsafeNativeMethods.cs
- TextBox.cs
- _DomainName.cs
- SinglePageViewer.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- KeyedHashAlgorithm.cs
- FrameworkElementFactoryMarkupObject.cs
- Crypto.cs
- ControlTemplate.cs
- XmlILStorageConverter.cs
- DataGridCommandEventArgs.cs
- GiveFeedbackEventArgs.cs
- Compiler.cs
- WebRequestModulesSection.cs
- SearchForVirtualItemEventArgs.cs
- ColorConverter.cs
- SoapAttributeAttribute.cs
- CheckBoxFlatAdapter.cs
- DataGridViewControlCollection.cs
- ProfileBuildProvider.cs
- TailPinnedEventArgs.cs
- SafeLocalMemHandle.cs
- XmlnsPrefixAttribute.cs
- CrossAppDomainChannel.cs
- TcpHostedTransportConfiguration.cs
- SafeArrayRankMismatchException.cs
- DurableInstanceProvider.cs
- HandledMouseEvent.cs
- UndoManager.cs
- ConditionalWeakTable.cs
- HexParser.cs
- ValidatorCompatibilityHelper.cs
- UnsafeNativeMethods.cs
- EditorZoneAutoFormat.cs
- EventLogPermissionEntryCollection.cs
- ExtendedPropertyInfo.cs
- ProofTokenCryptoHandle.cs
- CacheRequest.cs
- FormViewInsertEventArgs.cs
- BinaryKeyIdentifierClause.cs
- CompositionAdorner.cs
- GraphicsContext.cs
- CreateInstanceBinder.cs
- SubpageParaClient.cs
- Rect.cs
- FaultDescription.cs
- CustomAttribute.cs
- SelectionWordBreaker.cs
- SerialPort.cs
- DictionaryCustomTypeDescriptor.cs
- LazyTextWriterCreator.cs
- ReturnEventArgs.cs