Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / UI / WebControls / Substitution.cs / 1305376 / Substitution.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.WebControls { using System; using System.ComponentModel; using System.Globalization; using System.Security.Permissions; using System.Web; using System.Web.UI; ////// [ DefaultProperty("MethodName"), Designer("System.Web.UI.Design.WebControls.SubstitutionDesigner, " + AssemblyRef.SystemDesign), ParseChildren(true), PersistChildren(false), ] public class Substitution : Control { ////// /// public Substitution() { } ////// /// [ DefaultValue(""), WebCategory("Behavior"), WebSysDescription(SR.Substitution_MethodNameDescr) ] public virtual string MethodName { get { string s = ViewState["MethodName"] as string; return s == null? String.Empty : s; } set { ViewState["MethodName"] = value; } } protected override ControlCollection CreateControlCollection() { return new EmptyControlCollection(this); } // SECURITY CODE // VSWhidbey 253188: Permission assert to support page running below full trust [ReflectionPermission(SecurityAction.Assert, Flags=ReflectionPermissionFlag.MemberAccess)] private HttpResponseSubstitutionCallback GetDelegate(Type targetType, string methodName) { return (HttpResponseSubstitutionCallback)Delegate.CreateDelegate( typeof(HttpResponseSubstitutionCallback), targetType, methodName); } protected internal override void OnPreRender(EventArgs e) { base.OnPreRender(e); // VSWhidbey 84748: Temp fix, throw if we are within a cached control Control parent = Parent; while (parent != null) { if (parent is BasePartialCachingControl) { throw new HttpException( SR.GetString(SR.Substitution_CannotBeInCachedControl)); } parent = parent.Parent; } } protected internal override void Render(HtmlTextWriter writer) { RenderMarkup(writer); } internal void RenderMarkup(HtmlTextWriter writer) { if (MethodName.Length == 0) { return; } TemplateControl target = TemplateControl; if (target == null) { return; } // get the delegate to the method HttpResponseSubstitutionCallback callback = null; try { callback = GetDelegate(target.GetType(), MethodName); } catch { } if (callback == null) { throw new HttpException( SR.GetString(SR.Substitution_BadMethodName, MethodName)); } // add the substitution to the response Page.Response.WriteSubstitution(callback); } } } // 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
- Script.cs
- ListMarkerLine.cs
- ConnectionsZoneDesigner.cs
- SqlBulkCopy.cs
- MatrixTransform3D.cs
- ResolveCriteriaCD1.cs
- LayoutTable.cs
- TypeRefElement.cs
- String.cs
- ViewBox.cs
- EmptyEnumerable.cs
- WorkflowServiceInstance.cs
- AssemblyAttributes.cs
- MsmqBindingFilter.cs
- WindowsTitleBar.cs
- Boolean.cs
- CompressEmulationStream.cs
- FontEmbeddingManager.cs
- NumberFormatInfo.cs
- CounterSample.cs
- AnnotationStore.cs
- HtmlTableRowCollection.cs
- RewritingProcessor.cs
- DesignerCapabilities.cs
- IApplicationTrustManager.cs
- WebPartEditVerb.cs
- UnsafeNativeMethods.cs
- ProfileSettingsCollection.cs
- FactoryGenerator.cs
- WindowsUpDown.cs
- DataGridViewControlCollection.cs
- ThicknessAnimationBase.cs
- EntityContainer.cs
- SchemaImporterExtensionsSection.cs
- SafeSecurityHelper.cs
- DetailsViewRow.cs
- InputReportEventArgs.cs
- StrictAndMessageFilter.cs
- NavigationPropertyEmitter.cs
- smtpconnection.cs
- JsonCollectionDataContract.cs
- DescendantBaseQuery.cs
- ApplyImportsAction.cs
- Path.cs
- XmlHierarchicalDataSourceView.cs
- SoapAttributeOverrides.cs
- IConvertible.cs
- HttpChannelHelper.cs
- ReverseInheritProperty.cs
- SoapTypeAttribute.cs
- Rethrow.cs
- BindToObject.cs
- TreeNodeCollection.cs
- XmlSchemaAttributeGroupRef.cs
- SystemUdpStatistics.cs
- Size.cs
- DesignerLoader.cs
- PageOrientation.cs
- GeneralTransform2DTo3DTo2D.cs
- ResXResourceReader.cs
- XmlValueConverter.cs
- BamlCollectionHolder.cs
- CurrentChangingEventArgs.cs
- QilLiteral.cs
- ManifestBasedResourceGroveler.cs
- GridEntryCollection.cs
- PasswordPropertyTextAttribute.cs
- DbProviderFactory.cs
- DataRelationPropertyDescriptor.cs
- WindowsFont.cs
- FontCacheLogic.cs
- BamlRecordWriter.cs
- XmlSchemaAll.cs
- ManifestSignedXml.cs
- SelectorAutomationPeer.cs
- ResourceWriter.cs
- RoutedPropertyChangedEventArgs.cs
- DataProtection.cs
- FixedTextSelectionProcessor.cs
- ReflectionServiceProvider.cs
- SecurityException.cs
- WebPartPersonalization.cs
- StdValidatorsAndConverters.cs
- ThreadStartException.cs
- InertiaRotationBehavior.cs
- WebHttpSecurityModeHelper.cs
- SoapCodeExporter.cs
- SingleAnimationBase.cs
- FormsAuthenticationConfiguration.cs
- VarRemapper.cs
- StylusPointPropertyInfo.cs
- WsatAdminException.cs
- MailDefinition.cs
- FixedPageAutomationPeer.cs
- MembershipUser.cs
- SchemaImporterExtension.cs
- TransformPattern.cs
- SyndicationElementExtension.cs
- ContainerSelectorBehavior.cs
- FormViewCommandEventArgs.cs