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
- Queue.cs
- ClientScriptManager.cs
- ArrayListCollectionBase.cs
- WsdlWriter.cs
- DispatcherOperation.cs
- ProcessModuleDesigner.cs
- IDReferencePropertyAttribute.cs
- XmlSchemaImport.cs
- SafeLocalMemHandle.cs
- MSHTMLHost.cs
- CodeDefaultValueExpression.cs
- PiiTraceSource.cs
- DataGridViewCell.cs
- TryExpression.cs
- ZipIOBlockManager.cs
- QueueException.cs
- ReadWriteSpinLock.cs
- nulltextnavigator.cs
- XmlSchemaComplexContentRestriction.cs
- PriorityChain.cs
- HtmlAnchor.cs
- NamespaceList.cs
- RuntimeConfigLKG.cs
- XmlSchemaAny.cs
- SqlColumnizer.cs
- ControlCachePolicy.cs
- FormViewDeleteEventArgs.cs
- FileDialog_Vista.cs
- CultureInfo.cs
- TextRangeEdit.cs
- ServiceProviders.cs
- EmbeddedMailObject.cs
- DataSetMappper.cs
- ActivityMarkupSerializer.cs
- InternalUserCancelledException.cs
- StrokeIntersection.cs
- Application.cs
- DictionaryItemsCollection.cs
- CountAggregationOperator.cs
- FillBehavior.cs
- CodeCommentStatementCollection.cs
- MultiPageTextView.cs
- ControlOperationInvoker.cs
- InterleavedZipPartStream.cs
- DataColumnPropertyDescriptor.cs
- FileDialogPermission.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- LiteralControl.cs
- XsdDateTime.cs
- DrawListViewItemEventArgs.cs
- XmlConvert.cs
- ArgumentException.cs
- StretchValidation.cs
- PresentationTraceSources.cs
- EntityDataSourceDesignerHelper.cs
- WebScriptServiceHost.cs
- TrackingMemoryStream.cs
- ToolStripSplitButton.cs
- DataComponentMethodGenerator.cs
- DataTemplateKey.cs
- ExceptionUtil.cs
- ChildDocumentBlock.cs
- ActivityCodeDomSerializer.cs
- IdentityNotMappedException.cs
- ListViewItemEventArgs.cs
- AudioBase.cs
- SQLCharsStorage.cs
- VisualTransition.cs
- MemberDescriptor.cs
- RuleProcessor.cs
- WindowsFormsSynchronizationContext.cs
- StringAnimationBase.cs
- Token.cs
- CompilerResults.cs
- TaskResultSetter.cs
- unsafeIndexingFilterStream.cs
- UpdatePanelTrigger.cs
- ListBoxAutomationPeer.cs
- SqlFileStream.cs
- ToolStripDropTargetManager.cs
- RepeaterItemCollection.cs
- X509Certificate2.cs
- ImageMapEventArgs.cs
- ManifestSignatureInformation.cs
- PermissionAttributes.cs
- NotifyInputEventArgs.cs
- HttpResponseInternalWrapper.cs
- ConnectionStringSettingsCollection.cs
- _UncName.cs
- LabelEditEvent.cs
- XmlNodeChangedEventManager.cs
- Scalars.cs
- ToolStripSettings.cs
- CodeDelegateInvokeExpression.cs
- ProtectedConfiguration.cs
- FlowDecision.cs
- HScrollBar.cs
- Peer.cs
- SystemException.cs
- DataServiceKeyAttribute.cs