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
- SetterBaseCollection.cs
- NativeMethods.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- GAC.cs
- MenuItemStyle.cs
- ClientRuntimeConfig.cs
- UpdateCompiler.cs
- ListDictionaryInternal.cs
- ScrollProperties.cs
- UrlMappingsSection.cs
- WebPartDisplayModeEventArgs.cs
- TraceSection.cs
- UnicastIPAddressInformationCollection.cs
- DictionarySectionHandler.cs
- HttpGetServerProtocol.cs
- WindowsListViewItemStartMenu.cs
- HyperlinkAutomationPeer.cs
- GridView.cs
- LayoutEngine.cs
- CreateUserWizard.cs
- ExternalDataExchangeService.cs
- WindowsScroll.cs
- StorageMappingItemLoader.cs
- XmlSchemaSimpleTypeUnion.cs
- SqlClientFactory.cs
- CallContext.cs
- WebUtil.cs
- StringFreezingAttribute.cs
- IApplicationTrustManager.cs
- MemberDomainMap.cs
- InvokeProviderWrapper.cs
- CapabilitiesRule.cs
- RealProxy.cs
- CompilerGeneratedAttribute.cs
- ToggleButtonAutomationPeer.cs
- DataControlImageButton.cs
- XPathPatternParser.cs
- PackageController.cs
- safesecurityhelperavalon.cs
- WSSecurityOneDotOneReceiveSecurityHeader.cs
- QilIterator.cs
- TreeViewImageIndexConverter.cs
- Vars.cs
- NativeMethods.cs
- DummyDataSource.cs
- OleDbParameterCollection.cs
- CodeGen.cs
- UnsafeNativeMethods.cs
- MediaElement.cs
- AspCompat.cs
- ReturnEventArgs.cs
- AnchorEditor.cs
- BooleanStorage.cs
- CompositionAdorner.cs
- EncodingDataItem.cs
- DownloadProgressEventArgs.cs
- TransformedBitmap.cs
- TextTrailingWordEllipsis.cs
- ArcSegment.cs
- BitmapEffectGroup.cs
- VarRemapper.cs
- DynamicMethod.cs
- TableCellAutomationPeer.cs
- PropertyState.cs
- EntityViewContainer.cs
- SharedPerformanceCounter.cs
- ImageFormatConverter.cs
- AuthenticationSection.cs
- AmbientEnvironment.cs
- DataGridViewRowPostPaintEventArgs.cs
- uribuilder.cs
- JsonCollectionDataContract.cs
- HTTPRemotingHandler.cs
- IdentityNotMappedException.cs
- ExpandSegmentCollection.cs
- HyperlinkAutomationPeer.cs
- ListItem.cs
- BindingContext.cs
- VerificationAttribute.cs
- UriTemplateClientFormatter.cs
- _CommandStream.cs
- ContractMapping.cs
- QueryTask.cs
- SequenceDesigner.cs
- SourceCollection.cs
- MessageQueueKey.cs
- CreateUserWizardStep.cs
- oledbmetadatacolumnnames.cs
- XmlSchemaRedefine.cs
- ToolStripItemCollection.cs
- NativeBuffer.cs
- SqlCommandBuilder.cs
- DataGridViewComboBoxEditingControl.cs
- QueryPageSettingsEventArgs.cs
- CompositeScriptReference.cs
- COM2ExtendedTypeConverter.cs
- DataGridViewCellParsingEventArgs.cs
- PolicyStatement.cs
- securestring.cs
- KeyInterop.cs