Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- HScrollBar.cs
- FormsAuthenticationModule.cs
- ServiceReference.cs
- EmulateRecognizeCompletedEventArgs.cs
- PublishLicense.cs
- SolidBrush.cs
- SecurityStandardsManager.cs
- BitmapEffectCollection.cs
- DataControlFieldCell.cs
- VisualBrush.cs
- XPathAncestorIterator.cs
- D3DImage.cs
- SqlBulkCopyColumnMappingCollection.cs
- ImportCatalogPart.cs
- Int32Animation.cs
- FormViewModeEventArgs.cs
- ExtentCqlBlock.cs
- basecomparevalidator.cs
- TypeDescriptionProviderAttribute.cs
- DataGridLinkButton.cs
- _NetRes.cs
- ObjectManager.cs
- TagMapInfo.cs
- Button.cs
- NodeLabelEditEvent.cs
- SpecularMaterial.cs
- HtmlEncodedRawTextWriter.cs
- AspNetSynchronizationContext.cs
- CustomAttributeSerializer.cs
- WorkflowServiceHostFactory.cs
- EncodingInfo.cs
- TimerElapsedEvenArgs.cs
- ThumbAutomationPeer.cs
- PlainXmlDeserializer.cs
- ImageAnimator.cs
- AutoGeneratedField.cs
- CharStorage.cs
- HttpCacheVaryByContentEncodings.cs
- MembershipSection.cs
- SystemPens.cs
- DocumentViewerAutomationPeer.cs
- TimeSpanHelper.cs
- ToolStripSeparator.cs
- StylusEditingBehavior.cs
- DBDataPermissionAttribute.cs
- ToolStripRenderEventArgs.cs
- ConfigXmlCDataSection.cs
- DropShadowEffect.cs
- XamlHttpHandlerFactory.cs
- BindingListCollectionView.cs
- CodeConstructor.cs
- LightweightCodeGenerator.cs
- KeyEventArgs.cs
- XsltCompileContext.cs
- DefaultPropertiesToSend.cs
- UrlMappingsSection.cs
- CanonicalizationDriver.cs
- XmlSubtreeReader.cs
- DynamicHyperLink.cs
- TransactionScope.cs
- MailAddressCollection.cs
- InputLanguageEventArgs.cs
- LogExtent.cs
- Unit.cs
- CatalogPart.cs
- HttpValueCollection.cs
- CompiledAction.cs
- SystemColorTracker.cs
- XmlnsDictionary.cs
- ImageField.cs
- CallbackHandler.cs
- IdentityManager.cs
- BypassElement.cs
- StreamGeometry.cs
- LockedHandleGlyph.cs
- GregorianCalendar.cs
- XmlWellformedWriter.cs
- CallTemplateAction.cs
- DummyDataSource.cs
- DataGridViewCellLinkedList.cs
- OdbcCommandBuilder.cs
- CodeArrayIndexerExpression.cs
- CompositeScriptReferenceEventArgs.cs
- GuidTagList.cs
- EdmError.cs
- RandomNumberGenerator.cs
- ArgumentsParser.cs
- TemplateParser.cs
- TextProviderWrapper.cs
- ActivityFunc.cs
- DataBinding.cs
- XmlSchemaDocumentation.cs
- InkCollectionBehavior.cs
- MenuStrip.cs
- ReadContentAsBinaryHelper.cs
- FillRuleValidation.cs
- ServiceReflector.cs
- ToolStripDesignerAvailabilityAttribute.cs
- SessionPageStateSection.cs
- Point4DValueSerializer.cs