Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / AdPostCacheSubstitution.cs / 1305376 / AdPostCacheSubstitution.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * The class is used internally to handle post-cache substitution mechanism in * AdRotator. * * Copyright (c) 2002 Microsoft Corporation */ namespace System.Web.UI.WebControls { using System.Globalization; using System.IO; using System.Web.Util; internal class AdPostCacheSubstitution { private AdRotator _adRotatorHelper; private AdPostCacheSubstitution() {} internal AdPostCacheSubstitution(AdRotator adRotator) { _adRotatorHelper = new AdRotator(); _adRotatorHelper.CopyFrom(adRotator); _adRotatorHelper.IsPostCacheAdHelper = true; _adRotatorHelper.Page = new Page(); } internal void RegisterPostCacheCallBack(HttpContext context, Page page, HtmlTextWriter writer) { // Assumption: called from AdRotator's Render phase HttpResponseSubstitutionCallback callback = new HttpResponseSubstitutionCallback(Render); context.Response.WriteSubstitution(callback); } internal string Render(HttpContext context) { // Debug.Assert(_adRotatorHelper != null && _adRotatorHelper.Page != null); // In PostCache Substitution, we use a string writer to return the markup. StringWriter stringWriter = new StringWriter(CultureInfo.CurrentCulture); HtmlTextWriter htmlWriter = _adRotatorHelper.Page.CreateHtmlTextWriter(stringWriter); Debug.Assert(htmlWriter != null); _adRotatorHelper.RenderControl(htmlWriter); // Dump the content out as needed for post-cache substitution. return stringWriter.ToString(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* * The class is used internally to handle post-cache substitution mechanism in * AdRotator. * * Copyright (c) 2002 Microsoft Corporation */ namespace System.Web.UI.WebControls { using System.Globalization; using System.IO; using System.Web.Util; internal class AdPostCacheSubstitution { private AdRotator _adRotatorHelper; private AdPostCacheSubstitution() {} internal AdPostCacheSubstitution(AdRotator adRotator) { _adRotatorHelper = new AdRotator(); _adRotatorHelper.CopyFrom(adRotator); _adRotatorHelper.IsPostCacheAdHelper = true; _adRotatorHelper.Page = new Page(); } internal void RegisterPostCacheCallBack(HttpContext context, Page page, HtmlTextWriter writer) { // Assumption: called from AdRotator's Render phase HttpResponseSubstitutionCallback callback = new HttpResponseSubstitutionCallback(Render); context.Response.WriteSubstitution(callback); } internal string Render(HttpContext context) { // Debug.Assert(_adRotatorHelper != null && _adRotatorHelper.Page != null); // In PostCache Substitution, we use a string writer to return the markup. StringWriter stringWriter = new StringWriter(CultureInfo.CurrentCulture); HtmlTextWriter htmlWriter = _adRotatorHelper.Page.CreateHtmlTextWriter(stringWriter); Debug.Assert(htmlWriter != null); _adRotatorHelper.RenderControl(htmlWriter); // Dump the content out as needed for post-cache substitution. return stringWriter.ToString(); } } } // 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
- QilXmlReader.cs
- WebPartDescription.cs
- EventRoute.cs
- MorphHelper.cs
- SQLInt64Storage.cs
- PersonalizationDictionary.cs
- ValidationEventArgs.cs
- DataColumnMapping.cs
- BodyWriter.cs
- InputScopeAttribute.cs
- WebPartsPersonalization.cs
- RangeBase.cs
- GridViewPageEventArgs.cs
- SingleAnimationBase.cs
- DecimalAnimation.cs
- WeakReferenceEnumerator.cs
- RequestCachePolicy.cs
- DateTimeStorage.cs
- AppDomainUnloadedException.cs
- LayoutTableCell.cs
- EntityDataSourceMemberPath.cs
- SmiEventSink_DeferedProcessing.cs
- StateMachineHistory.cs
- AddressingVersion.cs
- DoubleConverter.cs
- UnsafeNativeMethods.cs
- RuleSettingsCollection.cs
- WebPartCollection.cs
- CollectionViewGroupInternal.cs
- Style.cs
- ProviderUtil.cs
- FocusWithinProperty.cs
- AssemblyInfo.cs
- SrgsElementFactory.cs
- AsymmetricSignatureDeformatter.cs
- SolidColorBrush.cs
- InfoCardRSACryptoProvider.cs
- ExtensionWindow.cs
- AssemblyAttributes.cs
- CqlParserHelpers.cs
- ConstraintEnumerator.cs
- UIPermission.cs
- SafePEFileHandle.cs
- MLangCodePageEncoding.cs
- ContextQuery.cs
- WebPartDisplayMode.cs
- PropertyDescriptorGridEntry.cs
- ListParagraph.cs
- BindingMAnagerBase.cs
- HtmlInputReset.cs
- ComboBox.cs
- BufferedReadStream.cs
- HwndMouseInputProvider.cs
- TableLayoutPanelCellPosition.cs
- ScalarType.cs
- Char.cs
- ListControlConvertEventArgs.cs
- ReadOnlyDataSource.cs
- DesignParameter.cs
- ListenerHandler.cs
- TextFormatterContext.cs
- embossbitmapeffect.cs
- DeadCharTextComposition.cs
- GroupByQueryOperator.cs
- FileClassifier.cs
- __Filters.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- TextContainerChangedEventArgs.cs
- SQLDouble.cs
- StrongNameKeyPair.cs
- DynamicResourceExtension.cs
- DesignerSerializationVisibilityAttribute.cs
- IPPacketInformation.cs
- ScaleTransform3D.cs
- CodeParameterDeclarationExpressionCollection.cs
- SystemTcpConnection.cs
- NgenServicingAttributes.cs
- CommandSet.cs
- SqlTriggerContext.cs
- SwitchElementsCollection.cs
- WebPartConnectionsConfigureVerb.cs
- SafeLibraryHandle.cs
- SiteMembershipCondition.cs
- Button.cs
- DllNotFoundException.cs
- CodeParameterDeclarationExpression.cs
- HttpRequest.cs
- FrameAutomationPeer.cs
- WebPartCancelEventArgs.cs
- DataRelationCollection.cs
- FunctionGenerator.cs
- DispatchChannelSink.cs
- PropertyDescriptorCollection.cs
- State.cs
- SpecularMaterial.cs
- VisualCollection.cs
- XmlBindingWorker.cs
- ConnectionStringSettingsCollection.cs
- DataGridViewLayoutData.cs
- DoWhileDesigner.xaml.cs