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
- Pen.cs
- StringBlob.cs
- Pens.cs
- NavigationProperty.cs
- CorePropertiesFilter.cs
- DataPagerFieldCommandEventArgs.cs
- SerializableAuthorizationContext.cs
- ApplicationSecurityInfo.cs
- XmlSchemaType.cs
- DependencyPropertyConverter.cs
- XmlDeclaration.cs
- DbConnectionPool.cs
- ExtendedProtectionPolicy.cs
- CustomPopupPlacement.cs
- ReferentialConstraint.cs
- FrameworkElement.cs
- WebPartTracker.cs
- BooleanFacetDescriptionElement.cs
- UnsafeNativeMethodsMilCoreApi.cs
- wgx_commands.cs
- TypeHelper.cs
- GroupBox.cs
- RadioButton.cs
- WindowsFormsHostAutomationPeer.cs
- DataGridViewCellStateChangedEventArgs.cs
- PropertyEmitter.cs
- TimelineCollection.cs
- EntitySetDataBindingList.cs
- HwndSourceParameters.cs
- StringSource.cs
- MouseGesture.cs
- MediaTimeline.cs
- HttpRequestCacheValidator.cs
- IIS7WorkerRequest.cs
- WizardStepBase.cs
- InvalidProgramException.cs
- UnmanagedMemoryStreamWrapper.cs
- GetPageNumberCompletedEventArgs.cs
- CollectionConverter.cs
- ObjectDataSource.cs
- HandlerMappingMemo.cs
- EndpointNotFoundException.cs
- Stylesheet.cs
- CharConverter.cs
- Page.cs
- RecognizedPhrase.cs
- CommandDevice.cs
- RegionInfo.cs
- StaticExtensionConverter.cs
- HtmlInputButton.cs
- AssemblyAttributesGoHere.cs
- SqlClientWrapperSmiStream.cs
- IHttpResponseInternal.cs
- WinFormsSecurity.cs
- ReferencedAssembly.cs
- ContentFileHelper.cs
- ResXBuildProvider.cs
- MsmqInputMessage.cs
- RealizationDrawingContextWalker.cs
- SplitterEvent.cs
- DesignerActionUI.cs
- DataTemplateSelector.cs
- HttpCachePolicyElement.cs
- CodeNamespaceCollection.cs
- WebHttpElement.cs
- DbException.cs
- ToolStripDropDownItem.cs
- MouseEvent.cs
- BatchParser.cs
- DataBindingHandlerAttribute.cs
- EventRecordWrittenEventArgs.cs
- VectorAnimationUsingKeyFrames.cs
- Assembly.cs
- ProxyManager.cs
- Calendar.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- WindowsAuthenticationModule.cs
- Visitors.cs
- DataBindEngine.cs
- OperatingSystemVersionCheck.cs
- BitmapEffectCollection.cs
- DataGridViewButtonColumn.cs
- TextEmbeddedObject.cs
- ReturnEventArgs.cs
- AssociationType.cs
- QueryOperatorEnumerator.cs
- File.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- RootBrowserWindow.cs
- ListViewHitTestInfo.cs
- HttpConfigurationSystem.cs
- ProfileProvider.cs
- ResourceWriter.cs
- PrintPreviewDialog.cs
- HyperlinkAutomationPeer.cs
- GuidTagList.cs
- ToolTip.cs
- XmlCustomFormatter.cs
- StoryFragments.cs
- XmlNodeWriter.cs