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
- XPathAncestorQuery.cs
- SqlBuffer.cs
- CreateSequenceResponse.cs
- OdbcParameterCollection.cs
- AlphabetConverter.cs
- ScrollViewerAutomationPeer.cs
- NotifyCollectionChangedEventArgs.cs
- CommandField.cs
- itemelement.cs
- SafeNativeMethods.cs
- ToolStripControlHost.cs
- ContainerVisual.cs
- ContentPosition.cs
- WebPartDeleteVerb.cs
- NegotiateStream.cs
- TreeNode.cs
- StylusPointPropertyUnit.cs
- ToolboxDataAttribute.cs
- PlacementWorkspace.cs
- WebBrowserBase.cs
- JpegBitmapEncoder.cs
- GeneralTransformGroup.cs
- ExplicitDiscriminatorMap.cs
- PublishLicense.cs
- EventSource.cs
- Vector3D.cs
- DesignerExtenders.cs
- ReflectionPermission.cs
- GcHandle.cs
- ArrayTypeMismatchException.cs
- Filter.cs
- DesignerDataColumn.cs
- FieldDescriptor.cs
- ClientApiGenerator.cs
- Monitor.cs
- SafeEventHandle.cs
- SiteMembershipCondition.cs
- StrongTypingException.cs
- TransformGroup.cs
- TypeUtil.cs
- Interlocked.cs
- OrthographicCamera.cs
- TypedColumnHandler.cs
- SafeCryptoKeyHandle.cs
- AttachedPropertyMethodSelector.cs
- RecommendedAsConfigurableAttribute.cs
- Config.cs
- DataSpaceManager.cs
- SpeechSeg.cs
- RootAction.cs
- HandledEventArgs.cs
- ConfigurationValues.cs
- ChangeNode.cs
- TaiwanCalendar.cs
- AsyncOperation.cs
- SafeNativeMethods.cs
- XPathDocumentIterator.cs
- FixedLineResult.cs
- XmlQueryTypeFactory.cs
- SqlNotificationEventArgs.cs
- AttributeEmitter.cs
- ExtenderProvidedPropertyAttribute.cs
- XmlIncludeAttribute.cs
- CheckBoxList.cs
- Dictionary.cs
- ItemsChangedEventArgs.cs
- BamlRecordHelper.cs
- Mouse.cs
- ResXDataNode.cs
- precedingsibling.cs
- DataRecordObjectView.cs
- FilterElement.cs
- TextSearch.cs
- XmlILIndex.cs
- ClientConfigPaths.cs
- HttpApplicationFactory.cs
- CodeNamespace.cs
- QueryCacheKey.cs
- _LocalDataStore.cs
- RelatedImageListAttribute.cs
- DataGridViewComboBoxColumn.cs
- DataRelation.cs
- DataBindingHandlerAttribute.cs
- UserControl.cs
- StylusPointPropertyId.cs
- SqlCaseSimplifier.cs
- QilGenerator.cs
- UserNameSecurityToken.cs
- NewArrayExpression.cs
- SqlNodeAnnotation.cs
- SqlUtil.cs
- ReliabilityContractAttribute.cs
- NestPullup.cs
- Point.cs
- CipherData.cs
- DataControlPagerLinkButton.cs
- EntityDataSourceUtil.cs
- HttpListenerResponse.cs
- LicFileLicenseProvider.cs
- InstanceDescriptor.cs