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
- ColorContext.cs
- UrlPropertyAttribute.cs
- AtomParser.cs
- Privilege.cs
- SystemDropShadowChrome.cs
- SystemDropShadowChrome.cs
- LoginView.cs
- PixelFormats.cs
- ReliableOutputSessionChannel.cs
- QilInvokeEarlyBound.cs
- SelectionWordBreaker.cs
- InstanceKeyNotReadyException.cs
- ZipIORawDataFileBlock.cs
- ConnectionPoolManager.cs
- UTF32Encoding.cs
- PeerInvitationResponse.cs
- ThrowHelper.cs
- FormClosingEvent.cs
- RequestQueue.cs
- CornerRadius.cs
- EmbossBitmapEffect.cs
- XmlChildNodes.cs
- HtmlCalendarAdapter.cs
- WmlTextViewAdapter.cs
- MemberRestriction.cs
- ProxyWebPartConnectionCollection.cs
- DataPointer.cs
- LambdaCompiler.Logical.cs
- Misc.cs
- GZipStream.cs
- Light.cs
- ProcessHostConfigUtils.cs
- GeneratedView.cs
- TcpClientCredentialType.cs
- SamlAuthorityBinding.cs
- RefreshInfo.cs
- ErrorStyle.cs
- HierarchicalDataSourceIDConverter.cs
- SafeCryptContextHandle.cs
- ConnectionStringEditor.cs
- ApplicationFileCodeDomTreeGenerator.cs
- HttpCookiesSection.cs
- XmlConvert.cs
- HtmlAnchor.cs
- ResourceLoader.cs
- XmlBinaryWriterSession.cs
- TreeNodeBindingCollection.cs
- WmlTextViewAdapter.cs
- ClientRolePrincipal.cs
- MailAddressCollection.cs
- DbgCompiler.cs
- DrawingVisualDrawingContext.cs
- xdrvalidator.cs
- TextOptionsInternal.cs
- ToolStripRenderEventArgs.cs
- HostingPreferredMapPath.cs
- HtmlImage.cs
- CheckBoxField.cs
- Stack.cs
- ResolveNameEventArgs.cs
- FakeModelPropertyImpl.cs
- EmbeddedObject.cs
- FontClient.cs
- RuleConditionDialog.Designer.cs
- TemplateBindingExpression.cs
- ClientScriptManager.cs
- PrintControllerWithStatusDialog.cs
- RtfControlWordInfo.cs
- Constants.cs
- IOThreadScheduler.cs
- HyperLinkDesigner.cs
- CommandBindingCollection.cs
- Viewport2DVisual3D.cs
- FrameAutomationPeer.cs
- HwndTarget.cs
- DecimalConstantAttribute.cs
- SmiEventSink_Default.cs
- RegexRunner.cs
- GifBitmapEncoder.cs
- Column.cs
- OutKeywords.cs
- XmlTextAttribute.cs
- DragCompletedEventArgs.cs
- BitmapEffectGroup.cs
- DbgCompiler.cs
- ExtentCqlBlock.cs
- ClientOptions.cs
- ControllableStoryboardAction.cs
- TransactionManager.cs
- LinqDataSource.cs
- ResourcePool.cs
- StorageBasedPackageProperties.cs
- IssuedSecurityTokenParameters.cs
- Ray3DHitTestResult.cs
- ExtensibleClassFactory.cs
- GradientStopCollection.cs
- InputScopeAttribute.cs
- SafeProcessHandle.cs
- WebBrowserUriTypeConverter.cs
- TrackingServices.cs