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
- XmlSchemaSimpleContent.cs
- METAHEADER.cs
- SoapIgnoreAttribute.cs
- SchemaTableOptionalColumn.cs
- CryptoKeySecurity.cs
- ToolStripContentPanelRenderEventArgs.cs
- StoryFragments.cs
- wmiprovider.cs
- FixedSchema.cs
- DependencyPropertyHelper.cs
- DataServices.cs
- XmlObjectSerializer.cs
- XamlInterfaces.cs
- MouseActionConverter.cs
- CheckoutException.cs
- ClientBuildManagerCallback.cs
- StringOutput.cs
- BinaryObjectInfo.cs
- PolicyStatement.cs
- NegotiateStream.cs
- PropertyGridDesigner.cs
- DataRowCollection.cs
- SAPIEngineTypes.cs
- EditorAttribute.cs
- DayRenderEvent.cs
- TextEditorCopyPaste.cs
- HttpContext.cs
- Utilities.cs
- XmlAttributeOverrides.cs
- XPSSignatureDefinition.cs
- StyleBamlRecordReader.cs
- XmlMemberMapping.cs
- IItemContainerGenerator.cs
- CodeAttachEventStatement.cs
- WSHttpBindingBaseElement.cs
- InputLangChangeRequestEvent.cs
- StringInfo.cs
- XmlDataSource.cs
- SettingsPropertyValueCollection.cs
- ConfigLoader.cs
- UnionExpr.cs
- DataSourceSerializationException.cs
- EmptyQuery.cs
- LoginCancelEventArgs.cs
- SupportsPreviewControlAttribute.cs
- TextEffect.cs
- CacheOutputQuery.cs
- PerformanceCounterManager.cs
- ChtmlTextWriter.cs
- PrintDialogException.cs
- EventLogStatus.cs
- ToolboxDataAttribute.cs
- TreeNodeStyle.cs
- RowType.cs
- DataRowExtensions.cs
- TemplatedWizardStep.cs
- MultipleViewProviderWrapper.cs
- IssuedSecurityTokenProvider.cs
- assertwrapper.cs
- AssemblyLoader.cs
- HostProtectionPermission.cs
- WindowsAuthenticationModule.cs
- StringHandle.cs
- DecoderFallback.cs
- SymLanguageVendor.cs
- BitmapFrame.cs
- GroupPartitionExpr.cs
- BitmapEffectInput.cs
- ISAPIWorkerRequest.cs
- CodeGotoStatement.cs
- MetadataWorkspace.cs
- InsufficientMemoryException.cs
- TransformerInfoCollection.cs
- DeclaredTypeElement.cs
- MatcherBuilder.cs
- UIEndRequest.cs
- WebPartHelpVerb.cs
- ResourceReferenceKeyNotFoundException.cs
- _Semaphore.cs
- NavigationProperty.cs
- InheritanceContextHelper.cs
- ToolboxItemCollection.cs
- Double.cs
- HttpGetProtocolImporter.cs
- SqlDataSourceQueryEditor.cs
- ChildDocumentBlock.cs
- FontSourceCollection.cs
- SqlBooleanizer.cs
- DataGridDesigner.cs
- XmlHelper.cs
- IntellisenseTextBox.designer.cs
- ShaderEffect.cs
- ExtensionSimplifierMarkupObject.cs
- TemplateContent.cs
- SqlBulkCopyColumnMappingCollection.cs
- EntitySetDataBindingList.cs
- ComponentSerializationService.cs
- _SecureChannel.cs
- InstalledFontCollection.cs
- HTTPRemotingHandler.cs