Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / AdPostCacheSubstitution.cs / 2 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ManagementPath.cs
- PropertyTab.cs
- TagPrefixInfo.cs
- GB18030Encoding.cs
- SymDocumentType.cs
- OraclePermission.cs
- PropertyDescriptorComparer.cs
- XmlUnspecifiedAttribute.cs
- Int16Animation.cs
- CodeTypeConstructor.cs
- SQlBooleanStorage.cs
- CollectionBuilder.cs
- PaperSource.cs
- ValidatorCollection.cs
- ToolStripContainer.cs
- PersonalizationEntry.cs
- NameValueFileSectionHandler.cs
- IIS7WorkerRequest.cs
- LocalValueEnumerator.cs
- CustomSignedXml.cs
- RowParagraph.cs
- DrawingImage.cs
- MimePart.cs
- ProtectedConfigurationSection.cs
- ComboBoxAutomationPeer.cs
- ServiceObjectContainer.cs
- Msec.cs
- VirtualizingStackPanel.cs
- AssemblyNameUtility.cs
- ProviderSettingsCollection.cs
- OpenTypeLayout.cs
- BamlLocalizableResourceKey.cs
- TypeElementCollection.cs
- WsdlWriter.cs
- ButtonColumn.cs
- UIHelper.cs
- X509CertificateClaimSet.cs
- ValidationSummary.cs
- OverlappedContext.cs
- UniqueEventHelper.cs
- KeyedHashAlgorithm.cs
- AudioStateChangedEventArgs.cs
- SelectionProcessor.cs
- WindowsRichEditRange.cs
- DataExpression.cs
- CommandField.cs
- CellTreeNodeVisitors.cs
- BatchWriter.cs
- AppDomainShutdownMonitor.cs
- ArgumentsParser.cs
- Stack.cs
- Animatable.cs
- Error.cs
- DecryptedHeader.cs
- EmptyTextWriter.cs
- SchemaExporter.cs
- SystemMulticastIPAddressInformation.cs
- SqlDataSourceRefreshSchemaForm.cs
- InArgumentConverter.cs
- CacheDependency.cs
- MetaDataInfo.cs
- Graph.cs
- UriTemplateLiteralQueryValue.cs
- NestedContainer.cs
- SourceItem.cs
- EntityObject.cs
- StateMachineTimers.cs
- DataSourceControlBuilder.cs
- OdbcConnectionOpen.cs
- PageDeviceFont.cs
- DbConnectionPoolGroupProviderInfo.cs
- ExtenderProvidedPropertyAttribute.cs
- XmlSchemaImporter.cs
- Helpers.cs
- ZipIOLocalFileHeader.cs
- XmlSchemaSet.cs
- ProtocolViolationException.cs
- HttpContextServiceHost.cs
- DefaultParameterValueAttribute.cs
- HtmlForm.cs
- QilInvoke.cs
- ThreadAbortException.cs
- VectorCollectionValueSerializer.cs
- SQLStringStorage.cs
- StylusPointProperty.cs
- CodeDirectoryCompiler.cs
- UDPClient.cs
- util.cs
- DeviceContexts.cs
- ZipIOFileItemStream.cs
- ConsoleKeyInfo.cs
- DateTimeOffsetConverter.cs
- ToolStripGrip.cs
- ServiceHostingEnvironment.cs
- odbcmetadatacolumnnames.cs
- EmptyEnumerator.cs
- hresults.cs
- ColorAnimationUsingKeyFrames.cs
- ComboBox.cs
- XmlnsCache.cs