Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Cache / SubstitutionResponseElement.cs / 1305376 / SubstitutionResponseElement.cs
using System; using System.Runtime.Serialization; using System.Security.Permissions; using System.Web; using System.Web.Caching; using System.Web.Compilation; namespace System.Web.Caching { [Serializable] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Unrestricted)] public class SubstitutionResponseElement: ResponseElement { [NonSerialized] private HttpResponseSubstitutionCallback _callback; private string _targetTypeName; private string _methodName; public HttpResponseSubstitutionCallback Callback { get { return _callback; } } private SubstitutionResponseElement() { } // hide default constructor public SubstitutionResponseElement(HttpResponseSubstitutionCallback callback) { if (callback == null) throw new ArgumentNullException("callback"); _callback = callback; } [OnSerializing()] private void OnSerializingMethod(StreamingContext context) { // create a string representation of the callback _targetTypeName = System.Web.UI.Util.GetAssemblyQualifiedTypeName(_callback.Method.ReflectedType); _methodName = _callback.Method.Name; } [OnDeserialized()] private void OnDeserializedMethod(StreamingContext context) { // re-create each ValidationCallbackInfo from its string representation Type target = BuildManager.GetType(_targetTypeName, true /*throwOnFail*/, false /*ignoreCase*/); _callback = (HttpResponseSubstitutionCallback) Delegate.CreateDelegate(typeof(HttpResponseSubstitutionCallback), target, _methodName); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Runtime.Serialization; using System.Security.Permissions; using System.Web; using System.Web.Caching; using System.Web.Compilation; namespace System.Web.Caching { [Serializable] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Unrestricted)] public class SubstitutionResponseElement: ResponseElement { [NonSerialized] private HttpResponseSubstitutionCallback _callback; private string _targetTypeName; private string _methodName; public HttpResponseSubstitutionCallback Callback { get { return _callback; } } private SubstitutionResponseElement() { } // hide default constructor public SubstitutionResponseElement(HttpResponseSubstitutionCallback callback) { if (callback == null) throw new ArgumentNullException("callback"); _callback = callback; } [OnSerializing()] private void OnSerializingMethod(StreamingContext context) { // create a string representation of the callback _targetTypeName = System.Web.UI.Util.GetAssemblyQualifiedTypeName(_callback.Method.ReflectedType); _methodName = _callback.Method.Name; } [OnDeserialized()] private void OnDeserializedMethod(StreamingContext context) { // re-create each ValidationCallbackInfo from its string representation Type target = BuildManager.GetType(_targetTypeName, true /*throwOnFail*/, false /*ignoreCase*/); _callback = (HttpResponseSubstitutionCallback) Delegate.CreateDelegate(typeof(HttpResponseSubstitutionCallback), target, _methodName); } } } // 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
- _SafeNetHandles.cs
- FlowLayoutPanel.cs
- XmlObjectSerializerWriteContextComplex.cs
- NavigationWindowAutomationPeer.cs
- RichTextBoxDesigner.cs
- IgnoreSectionHandler.cs
- SchemaDeclBase.cs
- WorkerRequest.cs
- ObjectSet.cs
- PlatformNotSupportedException.cs
- EntityException.cs
- ApplicationInfo.cs
- ObjectCacheHost.cs
- VisualProxy.cs
- ToolStripSplitButton.cs
- ReflectionUtil.cs
- XmlSiteMapProvider.cs
- RoleServiceManager.cs
- TranslateTransform.cs
- XmlSerializerNamespaces.cs
- MergeFailedEvent.cs
- DefaultClaimSet.cs
- HostingEnvironmentSection.cs
- Base64Encoder.cs
- Graphics.cs
- PointConverter.cs
- StorageMappingItemLoader.cs
- ACE.cs
- Queue.cs
- JapaneseLunisolarCalendar.cs
- HttpChannelHelper.cs
- HotSpotCollection.cs
- MinimizableAttributeTypeConverter.cs
- QueryResultOp.cs
- X509Certificate.cs
- IdentityManager.cs
- ScrollChangedEventArgs.cs
- ScriptReference.cs
- XmlWrappingReader.cs
- SqlDataSourceView.cs
- ColorIndependentAnimationStorage.cs
- DeobfuscatingStream.cs
- ApplicationGesture.cs
- SqlTrackingService.cs
- DataControlCommands.cs
- DeviceSpecificDesigner.cs
- DataGridViewColumnConverter.cs
- LogEntryDeserializer.cs
- FactoryMaker.cs
- RadioButtonPopupAdapter.cs
- KeyValueSerializer.cs
- SchemaImporterExtension.cs
- ItemCollection.cs
- ConnectionProviderAttribute.cs
- UInt64Storage.cs
- PriorityChain.cs
- MemberHolder.cs
- odbcmetadatacollectionnames.cs
- Currency.cs
- MetadataSet.cs
- SqlBulkCopyColumnMappingCollection.cs
- entityreference_tresulttype.cs
- CodeAttributeArgumentCollection.cs
- TempFiles.cs
- BridgeDataReader.cs
- SamlAssertionKeyIdentifierClause.cs
- DataListItemEventArgs.cs
- DisplayInformation.cs
- DateTimeFormatInfo.cs
- WebPartConnectionsCancelVerb.cs
- RemotingServices.cs
- AnnotationHighlightLayer.cs
- DiscoveryRequestHandler.cs
- WebPartPersonalization.cs
- Window.cs
- DocumentReference.cs
- ProviderUtil.cs
- ISSmlParser.cs
- PassportAuthenticationEventArgs.cs
- DefaultProxySection.cs
- COM2ColorConverter.cs
- AmbiguousMatchException.cs
- LogicalTreeHelper.cs
- StreamWithDictionary.cs
- EnumDataContract.cs
- SatelliteContractVersionAttribute.cs
- SortedList.cs
- ProcessHostServerConfig.cs
- Utils.cs
- GridItem.cs
- CodeValidator.cs
- IntAverageAggregationOperator.cs
- EpmAttributeNameBuilder.cs
- RangeExpression.cs
- QilStrConcatenator.cs
- Int16KeyFrameCollection.cs
- SecurityContext.cs
- PrintDocument.cs
- DataGridViewRowsAddedEventArgs.cs
- CodeGenerationManager.cs