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
- WebServiceErrorEvent.cs
- CodeDefaultValueExpression.cs
- WindowsAuthenticationEventArgs.cs
- ServiceMetadataBehavior.cs
- XNodeSchemaApplier.cs
- ZoneLinkButton.cs
- OleDbReferenceCollection.cs
- ClickablePoint.cs
- PropertyNames.cs
- XpsSerializerWriter.cs
- Opcode.cs
- DynamicQueryableWrapper.cs
- ContainerAction.cs
- ListBindingHelper.cs
- RC2CryptoServiceProvider.cs
- DrawListViewSubItemEventArgs.cs
- BooleanConverter.cs
- IgnoreDeviceFilterElement.cs
- SeparatorAutomationPeer.cs
- ZipIOLocalFileDataDescriptor.cs
- Int64AnimationUsingKeyFrames.cs
- MaskedTextBox.cs
- LockCookie.cs
- SQLInt64.cs
- EntitySqlQueryBuilder.cs
- EventHandlerList.cs
- OptimalBreakSession.cs
- translator.cs
- AssemblyResourceLoader.cs
- SecurityManager.cs
- TableLayoutCellPaintEventArgs.cs
- DataPagerFieldCollection.cs
- DetailsViewDeletedEventArgs.cs
- WorkflowRuntimeService.cs
- SQLUtility.cs
- ValidationRule.cs
- ContentElement.cs
- DocumentPaginator.cs
- FixedSOMTextRun.cs
- IssuanceLicense.cs
- SqlDataSourceQuery.cs
- IdSpace.cs
- HTTPAPI_VERSION.cs
- ItemsPresenter.cs
- DataGridRowClipboardEventArgs.cs
- XmlSiteMapProvider.cs
- HttpProcessUtility.cs
- WorkflowNamespace.cs
- LocationReferenceValue.cs
- DrawingContextDrawingContextWalker.cs
- ThemeableAttribute.cs
- XmlSchemaAttribute.cs
- ListBindingConverter.cs
- CombinedGeometry.cs
- UserControlDesigner.cs
- SystemUdpStatistics.cs
- EastAsianLunisolarCalendar.cs
- InternalResources.cs
- DataTableExtensions.cs
- SystemColorTracker.cs
- GeometryCollection.cs
- AggregationMinMaxHelpers.cs
- DaylightTime.cs
- DataGridViewTextBoxColumn.cs
- PermissionRequestEvidence.cs
- ByteStack.cs
- EncryptedKey.cs
- PersonalizableTypeEntry.cs
- TypeBuilder.cs
- WpfMemberInvoker.cs
- ToolStripDropDownMenu.cs
- SplineQuaternionKeyFrame.cs
- sqlcontext.cs
- IndicShape.cs
- EntitySetDataBindingList.cs
- _NegotiateClient.cs
- CodeSnippetCompileUnit.cs
- Label.cs
- PriorityRange.cs
- FreezableCollection.cs
- DataSourceView.cs
- SmiContext.cs
- ValidationUtility.cs
- XmlSchemaExternal.cs
- InvalidCommandTreeException.cs
- IntegerValidator.cs
- FileVersion.cs
- Page.cs
- SessionPageStatePersister.cs
- PermissionSetTriple.cs
- XmlWrappingWriter.cs
- GenericRootAutomationPeer.cs
- HwndMouseInputProvider.cs
- ToolStripScrollButton.cs
- ObjectListCommandCollection.cs
- LayoutTableCell.cs
- EmptyEnumerator.cs
- RC2.cs
- IndentedWriter.cs
- ChildTable.cs