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
- DBCommandBuilder.cs
- SpeechEvent.cs
- DocumentViewerConstants.cs
- TitleStyle.cs
- MtomMessageEncodingElement.cs
- StoreItemCollection.Loader.cs
- TriggerActionCollection.cs
- RawAppCommandInputReport.cs
- Int32Rect.cs
- InstanceKeyCompleteException.cs
- RowSpanVector.cs
- MaterialCollection.cs
- TimeZoneInfo.cs
- ContainerCodeDomSerializer.cs
- FontStretch.cs
- MarshalByValueComponent.cs
- BuildManager.cs
- HttpServerChannel.cs
- TaskExtensions.cs
- ModifierKeysValueSerializer.cs
- CompositeKey.cs
- DefaultPropertiesToSend.cs
- JpegBitmapEncoder.cs
- WhitespaceSignificantCollectionAttribute.cs
- PartialCachingAttribute.cs
- AQNBuilder.cs
- GridViewSelectEventArgs.cs
- WriteableBitmap.cs
- ParseNumbers.cs
- ImageCollectionEditor.cs
- PointF.cs
- TargetParameterCountException.cs
- WebPartZoneBase.cs
- WrapPanel.cs
- InvalidTimeZoneException.cs
- KnownColorTable.cs
- StylusShape.cs
- SqlBinder.cs
- CodeTypeMemberCollection.cs
- ProxyHwnd.cs
- GridViewSortEventArgs.cs
- ServiceDescriptionImporter.cs
- Emitter.cs
- Matrix3DConverter.cs
- HeaderUtility.cs
- MatrixTransform3D.cs
- MD5CryptoServiceProvider.cs
- ListItemsPage.cs
- DllNotFoundException.cs
- NavigationService.cs
- HtmlShimManager.cs
- DispatcherSynchronizationContext.cs
- StringBlob.cs
- RequestDescription.cs
- MemberDescriptor.cs
- LiteralLink.cs
- RegexCapture.cs
- GeometryCollection.cs
- CqlIdentifiers.cs
- LambdaCompiler.Unary.cs
- WsiProfilesElement.cs
- PeerTransportElement.cs
- SqlException.cs
- XhtmlBasicPageAdapter.cs
- CellTreeNodeVisitors.cs
- RenamedEventArgs.cs
- Descriptor.cs
- ExpressionBindings.cs
- BamlTreeNode.cs
- XmlStreamStore.cs
- FunctionMappingTranslator.cs
- GroupBox.cs
- GridViewRow.cs
- LinqMaximalSubtreeNominator.cs
- Dictionary.cs
- ToolStripPanel.cs
- Fault.cs
- HeaderedContentControl.cs
- SamlDoNotCacheCondition.cs
- ReadOnlyHierarchicalDataSource.cs
- PriorityBinding.cs
- DirectoryRedirect.cs
- ParserStreamGeometryContext.cs
- UMPAttributes.cs
- SqlCacheDependencyDatabaseCollection.cs
- RegexCompiler.cs
- ModuleBuilder.cs
- Compiler.cs
- ControlDesigner.cs
- CodeIterationStatement.cs
- DashStyle.cs
- MissingFieldException.cs
- SourceSwitch.cs
- SimpleHandlerFactory.cs
- Constraint.cs
- WinFormsSecurity.cs
- OracleInfoMessageEventArgs.cs
- PropertyInfoSet.cs
- SHA1Cng.cs
- ListViewInsertionMark.cs