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
- Bezier.cs
- UniqueConstraint.cs
- ToolStripMenuItemCodeDomSerializer.cs
- CompoundFileReference.cs
- StyleCollection.cs
- XmlImplementation.cs
- Bold.cs
- DataGridViewCellParsingEventArgs.cs
- SqlBooleanizer.cs
- AnimationTimeline.cs
- DynamicMethod.cs
- PointCollectionValueSerializer.cs
- IfElseDesigner.xaml.cs
- TextElementAutomationPeer.cs
- AlphabeticalEnumConverter.cs
- AvtEvent.cs
- HttpResponseHeader.cs
- DataBindingCollection.cs
- URL.cs
- ConfigurationPropertyCollection.cs
- HtmlButton.cs
- SystemGatewayIPAddressInformation.cs
- EntityContainerEmitter.cs
- DefaultClaimSet.cs
- ModelItemDictionaryImpl.cs
- InvalidateEvent.cs
- SchemaCollectionPreprocessor.cs
- WorkflowInstanceAbortedRecord.cs
- unitconverter.cs
- SourceFileBuildProvider.cs
- ELinqQueryState.cs
- SqlDataSourceQuery.cs
- RegexGroup.cs
- WebScriptEndpoint.cs
- DbConnectionPoolGroupProviderInfo.cs
- EmptyControlCollection.cs
- StyleXamlTreeBuilder.cs
- ExtractedStateEntry.cs
- ClientConfigPaths.cs
- ColorDialog.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- DataPointer.cs
- SpAudioStreamWrapper.cs
- Stopwatch.cs
- WebPartCloseVerb.cs
- SystemIPv4InterfaceProperties.cs
- PointAnimationBase.cs
- ByteArrayHelperWithString.cs
- DiscoveryOperationContext.cs
- ObjectItemNoOpAssemblyLoader.cs
- ValueChangedEventManager.cs
- PatternMatcher.cs
- LineGeometry.cs
- DataGridViewColumnStateChangedEventArgs.cs
- WindowsGraphicsCacheManager.cs
- XmlException.cs
- DecimalConverter.cs
- ControlCodeDomSerializer.cs
- IsolatedStorageFilePermission.cs
- AdCreatedEventArgs.cs
- ForeignKeyConstraint.cs
- PropertyGridEditorPart.cs
- SchemaComplexType.cs
- MeasureData.cs
- TrackingStringDictionary.cs
- ChangeTracker.cs
- HttpWebRequestElement.cs
- HttpChannelFactory.cs
- DocumentSchemaValidator.cs
- CardSpacePolicyElement.cs
- MissingMethodException.cs
- UnmanagedMemoryStream.cs
- DATA_BLOB.cs
- SimpleType.cs
- XmlBindingWorker.cs
- SmiConnection.cs
- BuiltInExpr.cs
- PersonalizationEntry.cs
- WebBrowserHelper.cs
- NetworkStream.cs
- Binding.cs
- VisualStateChangedEventArgs.cs
- SendMailErrorEventArgs.cs
- dsa.cs
- WhitespaceRuleReader.cs
- TemplatedWizardStep.cs
- ResourceManager.cs
- PageThemeBuildProvider.cs
- WrapPanel.cs
- DataViewSetting.cs
- RegexInterpreter.cs
- ListView.cs
- RemotingException.cs
- HttpCacheParams.cs
- HuffmanTree.cs
- MetafileHeader.cs
- DtdParser.cs
- DateRangeEvent.cs
- SQLInt32Storage.cs
- CompositeActivityMarkupSerializer.cs