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
- ChangeProcessor.cs
- SlotInfo.cs
- AutomationPeer.cs
- ContentHostHelper.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- RecommendedAsConfigurableAttribute.cs
- RunClient.cs
- SqlBulkCopyColumnMapping.cs
- XmlQualifiedName.cs
- WpfPayload.cs
- RectAnimationUsingKeyFrames.cs
- ListControlConvertEventArgs.cs
- SafeIUnknown.cs
- UpdateCommand.cs
- XmlAttribute.cs
- _LocalDataStoreMgr.cs
- ExpressionUtilities.cs
- ShaperBuffers.cs
- StringUtil.cs
- CookieParameter.cs
- DocumentApplicationDocumentViewer.cs
- ConfigurationProperty.cs
- Models.cs
- DbParameterCollectionHelper.cs
- FrameSecurityDescriptor.cs
- XPathAncestorIterator.cs
- SoapSchemaImporter.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- Metadata.cs
- SnapLine.cs
- DynamicPhysicalDiscoSearcher.cs
- SafeNativeMethods.cs
- DbProviderManifest.cs
- GridViewUpdatedEventArgs.cs
- Set.cs
- SqlCacheDependencySection.cs
- CodeAccessSecurityEngine.cs
- HttpSysSettings.cs
- XPathEmptyIterator.cs
- SqlXmlStorage.cs
- AdjustableArrowCap.cs
- ToggleButtonAutomationPeer.cs
- LayoutEditorPart.cs
- TemplateBamlTreeBuilder.cs
- ColorComboBox.cs
- EpmContentSerializerBase.cs
- NameSpaceEvent.cs
- GroupDescription.cs
- XmlSchemaDatatype.cs
- SystemEvents.cs
- IChannel.cs
- Oid.cs
- CryptoStream.cs
- WpfGeneratedKnownTypes.cs
- NativeMethods.cs
- XmlSchemaSimpleContent.cs
- PipeStream.cs
- StringFreezingAttribute.cs
- ErrorFormatterPage.cs
- ALinqExpressionVisitor.cs
- MetadataItem_Static.cs
- ComponentGuaranteesAttribute.cs
- ProcessModelSection.cs
- XmlSchemaComplexContent.cs
- DateTimeValueSerializer.cs
- DataBoundControlHelper.cs
- SingleKeyFrameCollection.cs
- PropertyChangedEventManager.cs
- BamlLocalizationDictionary.cs
- AxisAngleRotation3D.cs
- X509SecurityToken.cs
- UndoManager.cs
- PeerPresenceInfo.cs
- BorderGapMaskConverter.cs
- InputReferenceExpression.cs
- ImpersonationContext.cs
- ExpanderAutomationPeer.cs
- PrintController.cs
- RawTextInputReport.cs
- ServerValidateEventArgs.cs
- XmlHierarchyData.cs
- ForeignKeyConstraint.cs
- XPathDescendantIterator.cs
- Stream.cs
- LineGeometry.cs
- SmiEventSink.cs
- WebPartEventArgs.cs
- NavigateEvent.cs
- PeerEndPoint.cs
- ServiceOperationParameter.cs
- TemplateBindingExpression.cs
- ConnectionInterfaceCollection.cs
- XMLSchema.cs
- ToolboxControl.cs
- SessionStateSection.cs
- CatalogPartChrome.cs
- DictionaryEntry.cs
- IdnMapping.cs
- MaskedTextBox.cs
- XpsFilter.cs