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
- FileUtil.cs
- StaticDataManager.cs
- QueryInterceptorAttribute.cs
- ProcessModule.cs
- RequestReplyCorrelator.cs
- QueryIntervalOp.cs
- WebPartDisplayMode.cs
- PolicyStatement.cs
- PersonalizationProviderCollection.cs
- TypeDependencyAttribute.cs
- Int64AnimationBase.cs
- ThreadStartException.cs
- CharStorage.cs
- DataGridViewComboBoxEditingControl.cs
- SHA1Managed.cs
- HtmlMeta.cs
- BinaryCommonClasses.cs
- FamilyTypeface.cs
- XmlCharCheckingReader.cs
- ColorKeyFrameCollection.cs
- SmiRequestExecutor.cs
- CommandHelper.cs
- ProxyWebPartManager.cs
- MyContact.cs
- BadImageFormatException.cs
- DataTable.cs
- ReadOnlyHierarchicalDataSourceView.cs
- ApplicationDirectoryMembershipCondition.cs
- XmlSerializerSection.cs
- HTMLTextWriter.cs
- InternalCache.cs
- InstanceDescriptor.cs
- EndPoint.cs
- ContextStaticAttribute.cs
- GeometryValueSerializer.cs
- ToolboxDataAttribute.cs
- ReliabilityContractAttribute.cs
- WebPartCollection.cs
- WebServiceClientProxyGenerator.cs
- EventlogProvider.cs
- UnionCodeGroup.cs
- TextBoxBase.cs
- RedistVersionInfo.cs
- PersonalizablePropertyEntry.cs
- XamlVector3DCollectionSerializer.cs
- SimplePropertyEntry.cs
- ClaimTypeRequirement.cs
- FactoryGenerator.cs
- RemoteWebConfigurationHostServer.cs
- XmlNullResolver.cs
- StreamReader.cs
- RowUpdatingEventArgs.cs
- DaylightTime.cs
- SkipQueryOptionExpression.cs
- KoreanCalendar.cs
- LongValidator.cs
- CopyCodeAction.cs
- ResolveDuplex11AsyncResult.cs
- XmlLinkedNode.cs
- AutomationElementCollection.cs
- SecurityListenerSettingsLifetimeManager.cs
- ACL.cs
- UDPClient.cs
- DataServiceQueryProvider.cs
- ConfigXmlElement.cs
- OdbcHandle.cs
- SqlInternalConnectionSmi.cs
- SeverityFilter.cs
- XNodeValidator.cs
- CheckBoxStandardAdapter.cs
- WebPartCatalogAddVerb.cs
- RelationshipDetailsCollection.cs
- Proxy.cs
- HotSpot.cs
- Odbc32.cs
- WaitHandleCannotBeOpenedException.cs
- WmlCommandAdapter.cs
- SqlPersonalizationProvider.cs
- ActivityStateRecord.cs
- Opcode.cs
- LongPath.cs
- FontUnitConverter.cs
- OleDbException.cs
- TitleStyle.cs
- BinaryCommonClasses.cs
- TextAction.cs
- ComMethodElementCollection.cs
- TcpDuplicateContext.cs
- ProcessThread.cs
- DoubleStorage.cs
- WorkflowInstanceQuery.cs
- NegotiationTokenAuthenticatorStateCache.cs
- DnsPermission.cs
- Context.cs
- DesignerActionItemCollection.cs
- LicenseManager.cs
- FileClassifier.cs
- ConstraintStruct.cs
- CompiledXpathExpr.cs
- MetadataException.cs