Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / AdPostCacheSubstitution.cs / 1305376 / 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
- NativeMethodsOther.cs
- EpmSourcePathSegment.cs
- RectAnimationBase.cs
- MsmqException.cs
- LabelDesigner.cs
- ACL.cs
- CommandDevice.cs
- PackagingUtilities.cs
- TrustSection.cs
- BamlStream.cs
- AddDataControlFieldDialog.cs
- GatewayDefinition.cs
- ConfigXmlComment.cs
- DataGridColumnsPage.cs
- RectangleHotSpot.cs
- CheckBox.cs
- XmlDataSourceNodeDescriptor.cs
- JsonReader.cs
- nulltextnavigator.cs
- SafeEventHandle.cs
- DiscreteKeyFrames.cs
- OleDbException.cs
- BooleanToVisibilityConverter.cs
- RelationshipEntry.cs
- PlaceHolder.cs
- UIElement.cs
- Double.cs
- MetadataPropertyvalue.cs
- HtmlHead.cs
- TextTreeInsertUndoUnit.cs
- TcpProcessProtocolHandler.cs
- RawStylusInputCustomData.cs
- ArrayMergeHelper.cs
- PartitionResolver.cs
- ObjectDataSourceWizardForm.cs
- UnrecognizedAssertionsBindingElement.cs
- ColorDialog.cs
- DataGridViewCellParsingEventArgs.cs
- StoreItemCollection.cs
- ScrollBar.cs
- ParenthesizePropertyNameAttribute.cs
- ButtonAutomationPeer.cs
- ContentFileHelper.cs
- UserMapPath.cs
- ClientUtils.cs
- newitemfactory.cs
- CommonXSendMessage.cs
- HyperLink.cs
- SqlClientFactory.cs
- EntityModelSchemaGenerator.cs
- SqlRecordBuffer.cs
- SelectionItemPattern.cs
- LoginUtil.cs
- ListArgumentProvider.cs
- MeshGeometry3D.cs
- DataGridViewCheckBoxColumn.cs
- PointUtil.cs
- ReadOnlyDictionary.cs
- HebrewNumber.cs
- FacetValues.cs
- TextTreeRootNode.cs
- AdapterSwitches.cs
- RemotingConfiguration.cs
- ApplicationContext.cs
- SqlCacheDependencySection.cs
- ObjectResult.cs
- UnitySerializationHolder.cs
- ZipIOExtraFieldElement.cs
- HyperlinkAutomationPeer.cs
- XmlDownloadManager.cs
- SqlClientMetaDataCollectionNames.cs
- KeyedHashAlgorithm.cs
- DataRow.cs
- MenuItemBinding.cs
- Grid.cs
- Char.cs
- ListViewItem.cs
- GridPatternIdentifiers.cs
- XmlSchemas.cs
- ButtonBase.cs
- Compiler.cs
- Exceptions.cs
- _OSSOCK.cs
- SvcMapFileSerializer.cs
- GeneralTransform3D.cs
- HtmlMeta.cs
- StringResourceManager.cs
- BamlResourceContent.cs
- DataGridViewDataConnection.cs
- DetailsViewRow.cs
- WindowsTreeView.cs
- TypeConverterAttribute.cs
- CroppedBitmap.cs
- CqlLexer.cs
- ColumnCollection.cs
- ScrollProperties.cs
- PropertyEmitterBase.cs
- MsmqHostedTransportManager.cs
- HttpVersion.cs
- QueryContinueDragEventArgs.cs