Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / UI / WebControls / Substitution.cs / 1 / 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), ] [AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 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); } } }///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MemoryFailPoint.cs
- SessionEndingCancelEventArgs.cs
- BooleanFunctions.cs
- IndentedWriter.cs
- ActivityInfo.cs
- BinaryObjectWriter.cs
- EnterpriseServicesHelper.cs
- PrivilegeNotHeldException.cs
- ToolStripProgressBar.cs
- BufferBuilder.cs
- FilteredDataSetHelper.cs
- BitmapSourceSafeMILHandle.cs
- BindingMAnagerBase.cs
- SelectionEditingBehavior.cs
- ApplicationActivator.cs
- BindUriHelper.cs
- TransformerInfo.cs
- AccessDataSourceView.cs
- Clock.cs
- SpeechSynthesizer.cs
- HandledMouseEvent.cs
- XsdCachingReader.cs
- TableParaClient.cs
- SharedStatics.cs
- XmlDataImplementation.cs
- Rect.cs
- CompilerCollection.cs
- URIFormatException.cs
- Stylesheet.cs
- Rules.cs
- DataObjectFieldAttribute.cs
- _WinHttpWebProxyDataBuilder.cs
- AesCryptoServiceProvider.cs
- GeometryDrawing.cs
- TaiwanCalendar.cs
- contentDescriptor.cs
- AspNetSynchronizationContext.cs
- DataObjectFieldAttribute.cs
- WebPartDisplayMode.cs
- Frame.cs
- DataGridViewIntLinkedList.cs
- util.cs
- StatusBarAutomationPeer.cs
- FixedSOMLineRanges.cs
- RegistrySecurity.cs
- PeerSecurityManager.cs
- SafeRegistryKey.cs
- BitmapCache.cs
- HttpUnhandledOperationInvoker.cs
- StateBag.cs
- DataBindingList.cs
- SqlClientWrapperSmiStreamChars.cs
- DefaultObjectMappingItemCollection.cs
- SafeSecurityHelper.cs
- BackEase.cs
- coordinatorscratchpad.cs
- ConnectionDemuxer.cs
- DbConnectionClosed.cs
- ApplicationSettingsBase.cs
- NativeMethods.cs
- BamlResourceContent.cs
- ConfigXmlElement.cs
- glyphs.cs
- ItemsPanelTemplate.cs
- FieldTemplateUserControl.cs
- HttpStaticObjectsCollectionWrapper.cs
- AssociationType.cs
- CFStream.cs
- DataGridViewTextBoxColumn.cs
- SiteMapPath.cs
- RegexParser.cs
- WindowsHyperlink.cs
- SqlCharStream.cs
- Setter.cs
- XmlAttributeProperties.cs
- DataGridViewElement.cs
- DefaultDiscoveryService.cs
- SafeArrayTypeMismatchException.cs
- AttributeAction.cs
- TypeConverter.cs
- Soap11ServerProtocol.cs
- DrawToolTipEventArgs.cs
- UnsafeNativeMethods.cs
- DataGridSortCommandEventArgs.cs
- webclient.cs
- ControlCachePolicy.cs
- RotateTransform.cs
- ObjectStorage.cs
- DataGridViewCellParsingEventArgs.cs
- QilList.cs
- Int64AnimationBase.cs
- DetailsViewDeleteEventArgs.cs
- WindowInteractionStateTracker.cs
- XmlWellformedWriter.cs
- IndexOutOfRangeException.cs
- Propagator.ExtentPlaceholderCreator.cs
- ChainOfResponsibility.cs
- XmlAttributeCollection.cs
- MediaContextNotificationWindow.cs
- ExpanderAutomationPeer.cs