Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- Debug.cs
- BinHexEncoder.cs
- DrawingVisualDrawingContext.cs
- XmlSchemaProviderAttribute.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- FontStretch.cs
- remotingproxy.cs
- TimeStampChecker.cs
- DateTimeOffsetAdapter.cs
- MetadataPropertyCollection.cs
- NavigationProperty.cs
- DateTimeSerializationSection.cs
- TextPattern.cs
- ProfileService.cs
- InkCollectionBehavior.cs
- TextWriter.cs
- ColorAnimationUsingKeyFrames.cs
- ArglessEventHandlerProxy.cs
- XPathDocumentBuilder.cs
- TopClause.cs
- AsymmetricSignatureFormatter.cs
- PhysicalFontFamily.cs
- ConfigurationElement.cs
- IFlowDocumentViewer.cs
- VariantWrapper.cs
- RuntimeUtils.cs
- UTF7Encoding.cs
- BinarySerializer.cs
- DefaultHttpHandler.cs
- CodeAccessPermission.cs
- CachedFontFace.cs
- ValidationErrorCollection.cs
- ToolboxItem.cs
- UrlMapping.cs
- Transform3D.cs
- ConnectionPoint.cs
- QueryCacheKey.cs
- ListenerElementsCollection.cs
- OdbcConnectionHandle.cs
- XmlQuerySequence.cs
- MiniConstructorInfo.cs
- HTMLTextWriter.cs
- HttpChannelBindingToken.cs
- HttpContextServiceHost.cs
- Int32KeyFrameCollection.cs
- WebPartConnectionsCloseVerb.cs
- VisualState.cs
- WebPartPersonalization.cs
- AstNode.cs
- PlainXmlSerializer.cs
- PageContentAsyncResult.cs
- CodeObjectCreateExpression.cs
- SigningCredentials.cs
- ParserExtension.cs
- COM2ExtendedUITypeEditor.cs
- ReturnValue.cs
- ComplexLine.cs
- ControlValuePropertyAttribute.cs
- WebPartConnectionsConfigureVerb.cs
- SqlNodeTypeOperators.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- CqlQuery.cs
- QueryOperationResponseOfT.cs
- HttpEncoder.cs
- TemplateContentLoader.cs
- ChooseAction.cs
- HttpRequest.cs
- FilteredAttributeCollection.cs
- SqlBooleanizer.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- LinkClickEvent.cs
- BitVector32.cs
- Separator.cs
- IApplicationTrustManager.cs
- NavigationProperty.cs
- TempFiles.cs
- TypeCacheManager.cs
- IndexingContentUnit.cs
- ContextBase.cs
- ColorTransformHelper.cs
- HttpHandlerAction.cs
- ContractCodeDomInfo.cs
- SafeCoTaskMem.cs
- ServiceParser.cs
- LineSegment.cs
- DesignerLoader.cs
- ProfileGroupSettings.cs
- PixelShader.cs
- ParseNumbers.cs
- SqlWebEventProvider.cs
- BatchStream.cs
- ALinqExpressionVisitor.cs
- COAUTHINFO.cs
- PropertyFilterAttribute.cs
- CaseCqlBlock.cs
- Inline.cs
- OleDbConnectionInternal.cs
- HttpException.cs
- ForeignKeyConstraint.cs
- HtmlEmptyTagControlBuilder.cs