Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- Underline.cs
- RichTextBox.cs
- IndexedString.cs
- RemoteHelper.cs
- RequestQueryProcessor.cs
- documentsequencetextview.cs
- MenuItemBinding.cs
- DependentList.cs
- SystemSounds.cs
- WebPermission.cs
- FontSource.cs
- ScopelessEnumAttribute.cs
- MsmqIntegrationInputMessage.cs
- FontDialog.cs
- RadioButtonStandardAdapter.cs
- CompilerGlobalScopeAttribute.cs
- ColorInterpolationModeValidation.cs
- DebugInfoGenerator.cs
- HMACSHA256.cs
- ResourceDictionary.cs
- TextBounds.cs
- MultiView.cs
- CodeDelegateInvokeExpression.cs
- ManagementClass.cs
- EntityCommandDefinition.cs
- SimpleWorkerRequest.cs
- ConfigXmlSignificantWhitespace.cs
- securitycriticaldata.cs
- MonitoringDescriptionAttribute.cs
- IMembershipProvider.cs
- CodePageUtils.cs
- DrawingImage.cs
- ExtractCollection.cs
- HttpCookieCollection.cs
- MimeMapping.cs
- SqlCrossApplyToCrossJoin.cs
- RegexFCD.cs
- NumericUpDown.cs
- Pen.cs
- SortExpressionBuilder.cs
- ExtractorMetadata.cs
- DateTimeOffsetConverter.cs
- recordstatescratchpad.cs
- NullableFloatMinMaxAggregationOperator.cs
- WebZoneDesigner.cs
- Imaging.cs
- CellParagraph.cs
- TreeViewCancelEvent.cs
- GenerateScriptTypeAttribute.cs
- ExpressionBuilderContext.cs
- DataTemplateSelector.cs
- DocumentEventArgs.cs
- ObjectViewQueryResultData.cs
- SecUtil.cs
- HttpClientCertificate.cs
- StopStoryboard.cs
- TCEAdapterGenerator.cs
- MessageTransmitTraceRecord.cs
- DataGridViewUtilities.cs
- MissingManifestResourceException.cs
- MiniMapControl.xaml.cs
- JobStaple.cs
- NavigatorInput.cs
- DocumentPaginator.cs
- _ShellExpression.cs
- LambdaCompiler.Lambda.cs
- RequestContext.cs
- GZipObjectSerializer.cs
- MetadataCache.cs
- TableDetailsCollection.cs
- ListViewSelectEventArgs.cs
- TypeUnloadedException.cs
- InputDevice.cs
- StartFileNameEditor.cs
- ProcessInfo.cs
- CallbackWrapper.cs
- RubberbandSelector.cs
- WebControlAdapter.cs
- StringValueSerializer.cs
- TreeViewCancelEvent.cs
- CodeCompileUnit.cs
- IxmlLineInfo.cs
- BitmapFrame.cs
- SiteMapNode.cs
- InputProcessorProfilesLoader.cs
- MessageQueueInstaller.cs
- URLIdentityPermission.cs
- RtfNavigator.cs
- MenuTracker.cs
- RowBinding.cs
- basevalidator.cs
- RunWorkerCompletedEventArgs.cs
- DesignerPainter.cs
- IgnoreSectionHandler.cs
- Tokenizer.cs
- XmlCharType.cs
- WaitForChangedResult.cs
- FlowNode.cs
- SettingsProviderCollection.cs
- ConnectionPoint.cs