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
- Dispatcher.cs
- DataGridViewRowHeaderCell.cs
- InsufficientMemoryException.cs
- FileDialog_Vista.cs
- Helpers.cs
- UnsafeNativeMethods.cs
- LostFocusEventManager.cs
- UshortList2.cs
- IsolatedStoragePermission.cs
- ClientRolePrincipal.cs
- EmbeddedObject.cs
- DrawingContextDrawingContextWalker.cs
- FrameworkContentElement.cs
- XsltException.cs
- DefaultPropertyAttribute.cs
- ApplicationFileCodeDomTreeGenerator.cs
- GridLength.cs
- HttpBindingExtension.cs
- COM2AboutBoxPropertyDescriptor.cs
- DbExpressionVisitor.cs
- DefaultPropertyAttribute.cs
- ObjectParameter.cs
- PrintDialog.cs
- DataGridViewCellStateChangedEventArgs.cs
- ArrayList.cs
- DataGridCommandEventArgs.cs
- SecurityDescriptor.cs
- Semaphore.cs
- CellTreeNode.cs
- x509store.cs
- RuleSetCollection.cs
- DateTimeParse.cs
- UnauthorizedAccessException.cs
- SoapEnumAttribute.cs
- SQLBinaryStorage.cs
- CheckBoxList.cs
- NumericExpr.cs
- EncoderFallback.cs
- PtsPage.cs
- URLMembershipCondition.cs
- UpdatePanelTriggerCollection.cs
- MemberHolder.cs
- SqlProfileProvider.cs
- FileSystemEventArgs.cs
- ScriptModule.cs
- ArraySubsetEnumerator.cs
- EntityTransaction.cs
- HttpHeaderCollection.cs
- _ConnectionGroup.cs
- DataGridViewColumnStateChangedEventArgs.cs
- NameScopePropertyAttribute.cs
- ObjectSecurity.cs
- HttpInputStream.cs
- DefaultPropertyAttribute.cs
- BuildProvider.cs
- BamlBinaryReader.cs
- ProjectionPruner.cs
- WindowsStatusBar.cs
- Content.cs
- InlineObject.cs
- HttpTransportManager.cs
- ToolStripPanelRenderEventArgs.cs
- HttpListenerContext.cs
- SafeHGlobalHandleCritical.cs
- ImageBrush.cs
- DataGridViewTextBoxCell.cs
- DecoderFallbackWithFailureFlag.cs
- TableCell.cs
- ContextActivityUtils.cs
- DataRowCollection.cs
- HtmlShim.cs
- StyleTypedPropertyAttribute.cs
- LayoutManager.cs
- XmlQueryType.cs
- SurrogateEncoder.cs
- RC2CryptoServiceProvider.cs
- BrushValueSerializer.cs
- ImageList.cs
- XmlRawWriterWrapper.cs
- InputLangChangeRequestEvent.cs
- PostBackOptions.cs
- CultureMapper.cs
- RoutedEventHandlerInfo.cs
- SafeEventLogWriteHandle.cs
- WpfMemberInvoker.cs
- HashHelper.cs
- CatalogPartDesigner.cs
- ImageAutomationPeer.cs
- SqlDataSource.cs
- KeySpline.cs
- DocumentGridContextMenu.cs
- storepermissionattribute.cs
- StandardToolWindows.cs
- VoiceObjectToken.cs
- Maps.cs
- ListBoxAutomationPeer.cs
- InputScopeConverter.cs
- EncryptedXml.cs
- Filter.cs
- ResourceDescriptionAttribute.cs