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
- Tile.cs
- OpenTypeLayoutCache.cs
- MarkedHighlightComponent.cs
- SqlConnection.cs
- PointAnimationClockResource.cs
- Window.cs
- QuadraticBezierSegment.cs
- BrowserCapabilitiesCompiler.cs
- parserscommon.cs
- NameValueFileSectionHandler.cs
- UnsafeNativeMethods.cs
- ManagementQuery.cs
- CacheVirtualItemsEvent.cs
- SQLMoney.cs
- SecurityToken.cs
- HttpListener.cs
- SecurityDescriptor.cs
- FieldBuilder.cs
- WebConfigurationHost.cs
- FontEditor.cs
- ButtonRenderer.cs
- HashHelpers.cs
- CornerRadiusConverter.cs
- ValidationSummaryDesigner.cs
- OdbcPermission.cs
- XPathMessageFilterElementCollection.cs
- ClientTarget.cs
- AbstractSvcMapFileLoader.cs
- ServiceDescriptions.cs
- InheritablePropertyChangeInfo.cs
- CfgSemanticTag.cs
- PolyBezierSegmentFigureLogic.cs
- SecurityChannelListener.cs
- BasePropertyDescriptor.cs
- CustomBindingElement.cs
- util.cs
- SiteMapNodeItem.cs
- StylusPointProperty.cs
- MailWriter.cs
- DataGridItemCollection.cs
- QuaternionAnimation.cs
- EntityProxyTypeInfo.cs
- ControlCollection.cs
- FreeFormDragDropManager.cs
- Geometry3D.cs
- ProfileEventArgs.cs
- DelegatingConfigHost.cs
- XmlSchemaSubstitutionGroup.cs
- Latin1Encoding.cs
- Collection.cs
- HttpSessionStateWrapper.cs
- IconEditor.cs
- PeerNodeTraceRecord.cs
- Random.cs
- KeyGestureValueSerializer.cs
- ApplicationFileParser.cs
- CompressionTransform.cs
- FeatureSupport.cs
- BinaryReader.cs
- SymbolPair.cs
- Overlapped.cs
- CategoryGridEntry.cs
- MessagePartProtectionMode.cs
- RectangleGeometry.cs
- ThemeDictionaryExtension.cs
- FeatureAttribute.cs
- InternalBufferOverflowException.cs
- Visual3D.cs
- PermissionToken.cs
- PolyQuadraticBezierSegment.cs
- InertiaExpansionBehavior.cs
- WorkflowItemsPresenter.cs
- ManipulationDevice.cs
- DataGridItemCollection.cs
- _SSPIWrapper.cs
- WebColorConverter.cs
- PermissionToken.cs
- XmlToDatasetMap.cs
- NavigationWindow.cs
- SystemWebSectionGroup.cs
- XmlAnyAttributeAttribute.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- InvalidProgramException.cs
- ModelUIElement3D.cs
- OleDbTransaction.cs
- SQLResource.cs
- AdRotator.cs
- DataGridItemCollection.cs
- DecoderExceptionFallback.cs
- TextSpanModifier.cs
- DataContractJsonSerializer.cs
- TextChangedEventArgs.cs
- ButtonBase.cs
- SubclassTypeValidator.cs
- ActivityExecutorSurrogate.cs
- ScrollChrome.cs
- SizeConverter.cs
- GlobalItem.cs
- COM2PropertyPageUITypeConverter.cs
- GenericIdentity.cs