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
- ListViewCommandEventArgs.cs
- RIPEMD160.cs
- SafeNativeMethods.cs
- CompoundFileStorageReference.cs
- MessageQueue.cs
- Walker.cs
- WinEventTracker.cs
- NetworkInformationPermission.cs
- EntitySetBaseCollection.cs
- XPathNodePointer.cs
- NavigationExpr.cs
- Simplifier.cs
- ping.cs
- CrossContextChannel.cs
- ExecutionEngineException.cs
- AliasedSlot.cs
- StrongNameUtility.cs
- RuntimeHandles.cs
- AppDomain.cs
- QuadraticBezierSegment.cs
- PtsCache.cs
- ListBoxAutomationPeer.cs
- CatalogPartCollection.cs
- OptimizerPatterns.cs
- AuthorizationRule.cs
- DocobjHost.cs
- EventWaitHandleSecurity.cs
- ObjectKeyFrameCollection.cs
- Pair.cs
- SelectionChangedEventArgs.cs
- NonceCache.cs
- Permission.cs
- ObjectDataSourceMethodEventArgs.cs
- StorageFunctionMapping.cs
- UdpContractFilterBehavior.cs
- Context.cs
- WinFormsSpinner.cs
- EdmEntityTypeAttribute.cs
- MethodBuilder.cs
- ExpandableObjectConverter.cs
- StylusEditingBehavior.cs
- RequestCache.cs
- Attributes.cs
- RemoteWebConfigurationHostServer.cs
- HeaderedItemsControl.cs
- EpmSourcePathSegment.cs
- InkCollectionBehavior.cs
- EdmToObjectNamespaceMap.cs
- XmlUnspecifiedAttribute.cs
- StateWorkerRequest.cs
- OneOfConst.cs
- Size.cs
- _UriSyntax.cs
- CodeRegionDirective.cs
- ConditionalExpression.cs
- ConstNode.cs
- SizeFConverter.cs
- ConfigurationElement.cs
- TransactionFlowBindingElement.cs
- ToolStripItemEventArgs.cs
- OutputCacheProfileCollection.cs
- SoapExtensionImporter.cs
- WindowsRegion.cs
- HandoffBehavior.cs
- SafeBitVector32.cs
- LinqDataSourceEditData.cs
- FileLogRecord.cs
- FontUnit.cs
- SecurityHeaderElementInferenceEngine.cs
- SemanticResultValue.cs
- COM2FontConverter.cs
- DataServiceRequestOfT.cs
- MetaModel.cs
- CustomGrammar.cs
- ManipulationDeltaEventArgs.cs
- NotifyCollectionChangedEventArgs.cs
- TreeBuilder.cs
- ListControlConvertEventArgs.cs
- ThaiBuddhistCalendar.cs
- ObjectReferenceStack.cs
- TableLayoutPanel.cs
- XmlName.cs
- LicenseProviderAttribute.cs
- TypeLibConverter.cs
- MembershipSection.cs
- OdbcParameter.cs
- WebPartConnectionsCancelVerb.cs
- CompiledRegexRunner.cs
- AssociatedControlConverter.cs
- InfiniteIntConverter.cs
- BinaryFormatter.cs
- ColorConverter.cs
- BamlWriter.cs
- DateTimeConstantAttribute.cs
- DbConnectionPool.cs
- MetadataCache.cs
- ReadOnlyAttribute.cs
- listviewsubitemcollectioneditor.cs
- PermissionAttributes.cs
- HideDisabledControlAdapter.cs