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
- KeyNotFoundException.cs
- EventArgs.cs
- ObjectDataSource.cs
- BaseValidator.cs
- FillBehavior.cs
- KeyValuePair.cs
- Executor.cs
- InstanceCreationEditor.cs
- FormViewAutoFormat.cs
- DeferredElementTreeState.cs
- NameTable.cs
- ColumnWidthChangedEvent.cs
- HttpContext.cs
- SocketPermission.cs
- TraceHandlerErrorFormatter.cs
- PeerEndPoint.cs
- SafeFileMappingHandle.cs
- TextCollapsingProperties.cs
- AssociatedControlConverter.cs
- UrlMappingsSection.cs
- GeometryHitTestParameters.cs
- PageThemeBuildProvider.cs
- LinqDataSourceContextEventArgs.cs
- PathSegmentCollection.cs
- FileUtil.cs
- cache.cs
- __FastResourceComparer.cs
- PerfProviderCollection.cs
- GeneralTransform2DTo3DTo2D.cs
- StringArrayEditor.cs
- Parsers.cs
- DebugInfo.cs
- XsltFunctions.cs
- UInt64.cs
- BaseDataBoundControlDesigner.cs
- activationcontext.cs
- TrackingProfileDeserializationException.cs
- RegexFCD.cs
- RulePatternOps.cs
- URLIdentityPermission.cs
- CacheModeConverter.cs
- CatalogPartChrome.cs
- LogEntryHeaderSerializer.cs
- CommandPlan.cs
- DataGridTableCollection.cs
- HMACSHA384.cs
- QueryParameter.cs
- TypeToken.cs
- DragAssistanceManager.cs
- ObjectParameterCollection.cs
- RoutedPropertyChangedEventArgs.cs
- UnsafeNativeMethods.cs
- ListViewSelectEventArgs.cs
- FamilyMapCollection.cs
- SiteMapDataSourceView.cs
- TemplateColumn.cs
- CacheDependency.cs
- StoryFragments.cs
- ControlValuePropertyAttribute.cs
- ScrollEventArgs.cs
- JulianCalendar.cs
- Label.cs
- IdnMapping.cs
- Image.cs
- _ScatterGatherBuffers.cs
- ListCommandEventArgs.cs
- DLinqDataModelProvider.cs
- LinearGradientBrush.cs
- AppDomainFactory.cs
- EntityDataSourceContextCreatingEventArgs.cs
- GenericsNotImplementedException.cs
- AutoCompleteStringCollection.cs
- ResourceIDHelper.cs
- DateTimeSerializationSection.cs
- TypeLibConverter.cs
- VideoDrawing.cs
- ReflectTypeDescriptionProvider.cs
- NodeFunctions.cs
- HttpProfileBase.cs
- PnrpPeerResolver.cs
- ImportCatalogPart.cs
- ByteConverter.cs
- TransformedBitmap.cs
- PrinterResolution.cs
- ExtensionSimplifierMarkupObject.cs
- Debugger.cs
- CompareValidator.cs
- FilteredAttributeCollection.cs
- ThreadStateException.cs
- CompatibleIComparer.cs
- DocumentCollection.cs
- XamlReaderHelper.cs
- SigningCredentials.cs
- PathFigureCollection.cs
- TextRangeSerialization.cs
- RemoveStoryboard.cs
- PolicyLevel.cs
- ReadOnlyKeyedCollection.cs
- CodeChecksumPragma.cs
- LocalBuilder.cs