Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- DataSourceIDConverter.cs
- ProvidePropertyAttribute.cs
- ArrangedElement.cs
- Block.cs
- HashHelper.cs
- TraceUtils.cs
- OutOfProcStateClientManager.cs
- UshortList2.cs
- XmlSortKeyAccumulator.cs
- FaultContractInfo.cs
- CaseStatement.cs
- TextTreePropertyUndoUnit.cs
- TagPrefixCollection.cs
- CacheVirtualItemsEvent.cs
- SynchronizingStream.cs
- UnsafeNativeMethods.cs
- AttributeCollection.cs
- CqlQuery.cs
- XslCompiledTransform.cs
- AssertFilter.cs
- XmlDocument.cs
- RoleExceptions.cs
- StackSpiller.cs
- LineUtil.cs
- COAUTHIDENTITY.cs
- BasicExpressionVisitor.cs
- XmlSchemaGroupRef.cs
- RelatedView.cs
- WindowsTokenRoleProvider.cs
- CompositeDispatchFormatter.cs
- EncryptedKeyIdentifierClause.cs
- SoapRpcServiceAttribute.cs
- BitmapEffectDrawingContextWalker.cs
- SoapMessage.cs
- CfgArc.cs
- TypeLoader.cs
- NavigationWindowAutomationPeer.cs
- DoubleUtil.cs
- RegexStringValidator.cs
- ColorConverter.cs
- WebZoneDesigner.cs
- IxmlLineInfo.cs
- SafeLibraryHandle.cs
- HyperLinkColumn.cs
- BitmapEffectGeneralTransform.cs
- ElementProxy.cs
- XmlBinaryWriterSession.cs
- RSAPKCS1SignatureFormatter.cs
- DynamicPropertyHolder.cs
- TraversalRequest.cs
- ErrorFormatterPage.cs
- ListSortDescription.cs
- StrokeCollectionDefaultValueFactory.cs
- BindingContext.cs
- FixUp.cs
- RotationValidation.cs
- UserControlBuildProvider.cs
- ImageCodecInfoPrivate.cs
- mediaeventargs.cs
- _ProxyRegBlob.cs
- DataSourceSelectArguments.cs
- CryptoApi.cs
- XmlWrappingWriter.cs
- ExpressionTable.cs
- XPathConvert.cs
- TraceUtils.cs
- ResXFileRef.cs
- DbFunctionCommandTree.cs
- DefaultAssemblyResolver.cs
- DrawingGroup.cs
- Action.cs
- CalendarModeChangedEventArgs.cs
- nulltextnavigator.cs
- Update.cs
- EDesignUtil.cs
- RewritingPass.cs
- RawUIStateInputReport.cs
- DbProviderFactories.cs
- SimplePropertyEntry.cs
- AdornerPresentationContext.cs
- GridLength.cs
- DbSource.cs
- ComIntegrationManifestGenerator.cs
- PagePropertiesChangingEventArgs.cs
- ScriptResourceAttribute.cs
- PasswordRecoveryAutoFormat.cs
- EventData.cs
- DiscriminatorMap.cs
- PointAnimationBase.cs
- CodeTryCatchFinallyStatement.cs
- ConfigDefinitionUpdates.cs
- UnknownBitmapEncoder.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- StructuredTypeEmitter.cs
- UserPersonalizationStateInfo.cs
- FileUpload.cs
- DurableErrorHandler.cs
- ListBoxItem.cs
- ConnectionPoolRegistry.cs
- DecimalAverageAggregationOperator.cs