Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / UI / WebControls / AdPostCacheSubstitution.cs / 2 / 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. //------------------------------------------------------------------------------ //// 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ToolStripContainer.cs
- CounterSample.cs
- TreeNodeStyle.cs
- ClientProxyGenerator.cs
- GeneralTransformGroup.cs
- EpmCustomContentSerializer.cs
- SqlTopReducer.cs
- RefExpr.cs
- DateTimeFormatInfoScanner.cs
- HtmlMobileTextWriter.cs
- XmlReaderDelegator.cs
- ToolStripRenderer.cs
- SqlDataSourceQueryConverter.cs
- XPathNavigator.cs
- ProvidePropertyAttribute.cs
- SourceChangedEventArgs.cs
- SqlInfoMessageEvent.cs
- SQLSingle.cs
- ViewgenContext.cs
- ParameterReplacerVisitor.cs
- dbdatarecord.cs
- NetSectionGroup.cs
- DataColumnPropertyDescriptor.cs
- CommonXSendMessage.cs
- AdjustableArrowCap.cs
- QilPatternVisitor.cs
- ScriptDescriptor.cs
- SQLInt16Storage.cs
- SelectionRangeConverter.cs
- OuterGlowBitmapEffect.cs
- FileDialog.cs
- RichTextBoxAutomationPeer.cs
- LayoutSettings.cs
- ScriptModule.cs
- SemanticTag.cs
- CFGGrammar.cs
- XPathScanner.cs
- WebPartEditVerb.cs
- QilLiteral.cs
- ObjectCloneHelper.cs
- GAC.cs
- ConfigXmlCDataSection.cs
- IConvertible.cs
- WSSecurityOneDotOneSendSecurityHeader.cs
- InstanceKeyCollisionException.cs
- ToolboxBitmapAttribute.cs
- TextTreeTextElementNode.cs
- TemplatePagerField.cs
- RestHandlerFactory.cs
- XmlSchemaGroup.cs
- Application.cs
- BinaryReader.cs
- ToolStripStatusLabel.cs
- ReadOnlyCollection.cs
- odbcmetadatacolumnnames.cs
- TypedTableBase.cs
- TripleDES.cs
- DynamicFilter.cs
- OrderedDictionary.cs
- TraceHandlerErrorFormatter.cs
- SimpleTypeResolver.cs
- SupportsEventValidationAttribute.cs
- ComponentResourceManager.cs
- SHA512.cs
- BrowserInteropHelper.cs
- MessageBox.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- ScriptResourceAttribute.cs
- ToolStripOverflow.cs
- Buffer.cs
- InternalResources.cs
- XmlArrayItemAttribute.cs
- DesignerTransactionCloseEvent.cs
- DataKeyCollection.cs
- SerializationFieldInfo.cs
- BuildResult.cs
- ListDictionaryInternal.cs
- ThicknessAnimationBase.cs
- GenerateTemporaryTargetAssembly.cs
- SAPIEngineTypes.cs
- ResetableIterator.cs
- FileDataSourceCache.cs
- OverflowException.cs
- CodeMemberEvent.cs
- Literal.cs
- MultiBinding.cs
- ExecutionContext.cs
- DictionaryTraceRecord.cs
- List.cs
- HostingEnvironmentException.cs
- BuildProviderAppliesToAttribute.cs
- Point3D.cs
- SapiRecoContext.cs
- InvalidAsynchronousStateException.cs
- DataGridRow.cs
- XamlBrushSerializer.cs
- FloaterParaClient.cs
- CreateUserErrorEventArgs.cs
- SqlFactory.cs
- TextDecorationCollectionConverter.cs