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
- OLEDB_Util.cs
- ProtectedConfigurationProviderCollection.cs
- ResourceProviderFactory.cs
- PrintDialog.cs
- XslTransform.cs
- safePerfProviderHandle.cs
- Vector3D.cs
- ZipIOExtraFieldPaddingElement.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- InternalDispatchObject.cs
- Helper.cs
- VirtualizedItemPattern.cs
- CodeAttributeArgumentCollection.cs
- SerializationSectionGroup.cs
- XmlDomTextWriter.cs
- DeploymentExceptionMapper.cs
- ServerValidateEventArgs.cs
- ObjectSpanRewriter.cs
- ObjectListField.cs
- BigInt.cs
- SmiXetterAccessMap.cs
- SimpleHandlerBuildProvider.cs
- WindowsRebar.cs
- DataAdapter.cs
- Model3DCollection.cs
- AuthenticateEventArgs.cs
- NeutralResourcesLanguageAttribute.cs
- SecurityDocument.cs
- Convert.cs
- EventBuilder.cs
- DataGridViewLinkColumn.cs
- AssemblyNameEqualityComparer.cs
- CodeSnippetCompileUnit.cs
- RTLAwareMessageBox.cs
- DataGridTablesFactory.cs
- AvTraceFormat.cs
- SettingsPropertyNotFoundException.cs
- UpdateExpressionVisitor.cs
- DataGridBoolColumn.cs
- SQLInt64Storage.cs
- Compiler.cs
- ISAPIRuntime.cs
- OutOfProcStateClientManager.cs
- SpellerInterop.cs
- SpecularMaterial.cs
- AssemblyInfo.cs
- DefaultEventAttribute.cs
- HttpContext.cs
- Type.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- xmlNames.cs
- FontInfo.cs
- EntityDataSourceDesigner.cs
- BlockCollection.cs
- ToolbarAUtomationPeer.cs
- FunctionUpdateCommand.cs
- lengthconverter.cs
- XamlStackWriter.cs
- CngKeyCreationParameters.cs
- XmlILStorageConverter.cs
- RecordBuilder.cs
- DataConnectionHelper.cs
- FieldReference.cs
- StreamGeometry.cs
- EventEntry.cs
- XmlSchemaIdentityConstraint.cs
- BaseComponentEditor.cs
- InternalBufferOverflowException.cs
- SourceCollection.cs
- ListViewAutomationPeer.cs
- ObsoleteAttribute.cs
- Quaternion.cs
- XDeferredAxisSource.cs
- CodeTypeReference.cs
- DiagnosticsConfigurationHandler.cs
- SqlRowUpdatingEvent.cs
- EntitySqlQueryState.cs
- OdbcEnvironment.cs
- PageThemeParser.cs
- HwndAppCommandInputProvider.cs
- TargetException.cs
- ExpressionEditorAttribute.cs
- WebPartEditorCancelVerb.cs
- SequenceNumber.cs
- CustomActivityDesigner.cs
- SmtpNtlmAuthenticationModule.cs
- GCHandleCookieTable.cs
- PeerResolverMode.cs
- HelpProvider.cs
- _LazyAsyncResult.cs
- InfoCardHelper.cs
- CustomAttributeFormatException.cs
- XmlDictionaryReaderQuotas.cs
- ProfileSection.cs
- CompareInfo.cs
- SynchronizingStream.cs
- ManifestBasedResourceGroveler.cs
- DataShape.cs
- TypeElement.cs
- Hashtable.cs