Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / xsp / System / Web / UI / WebControls / AdPostCacheSubstitution.cs / 1 / 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
- ConstNode.cs
- TreePrinter.cs
- UnauthorizedWebPart.cs
- TextLine.cs
- CodeAssignStatement.cs
- DBAsyncResult.cs
- PagesChangedEventArgs.cs
- WebPartMovingEventArgs.cs
- SqlServer2KCompatibilityAnnotation.cs
- Run.cs
- DebuggerAttributes.cs
- RtfToken.cs
- PeerNameRecord.cs
- HttpHandlersSection.cs
- SafeMILHandleMemoryPressure.cs
- DataExchangeServiceBinder.cs
- _ChunkParse.cs
- ZipIOCentralDirectoryFileHeader.cs
- HandledMouseEvent.cs
- DataRelationCollection.cs
- HostingEnvironmentWrapper.cs
- FontDialog.cs
- WindowsFormsSynchronizationContext.cs
- SmtpException.cs
- BitArray.cs
- LinqDataSourceHelper.cs
- InputScopeAttribute.cs
- PageParser.cs
- ListBoxAutomationPeer.cs
- ConnectionPoolManager.cs
- WaitHandleCannotBeOpenedException.cs
- XmlProcessingInstruction.cs
- NameTable.cs
- XmlValidatingReaderImpl.cs
- SubordinateTransaction.cs
- GradientStopCollection.cs
- AssemblyCache.cs
- RTLAwareMessageBox.cs
- PersonalizationStateQuery.cs
- ButtonBase.cs
- RC2.cs
- IndicCharClassifier.cs
- ApplicationTrust.cs
- XmlDataImplementation.cs
- SemanticBasicElement.cs
- ObjectViewFactory.cs
- SafeViewOfFileHandle.cs
- Binding.cs
- StylusEditingBehavior.cs
- StorageAssociationSetMapping.cs
- DesignerAdapterUtil.cs
- WizardForm.cs
- WindowsListView.cs
- BulletedList.cs
- BrowserDefinition.cs
- EventPrivateKey.cs
- ChooseAction.cs
- ClientTargetCollection.cs
- ContractCodeDomInfo.cs
- ConfigXmlComment.cs
- ModelItem.cs
- UnhandledExceptionEventArgs.cs
- ChildTable.cs
- MarshalByRefObject.cs
- COM2FontConverter.cs
- DataGridAddNewRow.cs
- ListViewUpdatedEventArgs.cs
- ExceptionUtil.cs
- ServerIdentity.cs
- BaseAsyncResult.cs
- BitmapEffectRenderDataResource.cs
- SqlDataSourceFilteringEventArgs.cs
- LocalValueEnumerator.cs
- VisualBasicImportReference.cs
- CfgParser.cs
- RoleServiceManager.cs
- CalendarDateRange.cs
- AsymmetricCryptoHandle.cs
- SAPIEngineTypes.cs
- OdbcDataAdapter.cs
- BaseTreeIterator.cs
- EncoderReplacementFallback.cs
- TableItemProviderWrapper.cs
- DiscriminatorMap.cs
- RegexFCD.cs
- ListViewItemEventArgs.cs
- ToggleProviderWrapper.cs
- TreeSet.cs
- DataSourceHelper.cs
- AutomationProperties.cs
- LoginUtil.cs
- ParameterCollection.cs
- ConfigurationManager.cs
- ReaderWriterLock.cs
- ReadOnlyAttribute.cs
- DataListDesigner.cs
- DataChangedEventManager.cs
- XmlUnspecifiedAttribute.cs
- WebPartHelpVerb.cs
- TextServicesDisplayAttributePropertyRanges.cs