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
- ConfigurationElementProperty.cs
- IndexExpression.cs
- EditorPartChrome.cs
- JumpTask.cs
- ClientRuntimeConfig.cs
- NamedPipeTransportBindingElement.cs
- TextParagraphCache.cs
- SchemaMapping.cs
- CompilerWrapper.cs
- OptimizerPatterns.cs
- FormClosingEvent.cs
- GenericIdentity.cs
- LayoutInformation.cs
- XmlDocumentViewSchema.cs
- XmlValidatingReader.cs
- DetailsViewRowCollection.cs
- WorkflowValidationFailedException.cs
- ConfigurationException.cs
- LambdaExpression.cs
- SqlRowUpdatedEvent.cs
- BindingExpression.cs
- TextRangeBase.cs
- MdImport.cs
- HttpCacheVaryByContentEncodings.cs
- UnsafeNativeMethodsTablet.cs
- XmlComment.cs
- SqlCaseSimplifier.cs
- DataRowCollection.cs
- MethodRental.cs
- SelectionBorderGlyph.cs
- DataGridViewRowCancelEventArgs.cs
- AutomationPropertyInfo.cs
- OracleParameterBinding.cs
- ManagedFilter.cs
- ComAwareEventInfo.cs
- ToolStripManager.cs
- ServiceNotStartedException.cs
- configsystem.cs
- NameNode.cs
- SpellerInterop.cs
- LocatorPart.cs
- BasicCellRelation.cs
- CompiledQuery.cs
- PartitionResolver.cs
- PathSegment.cs
- CodeNamespaceCollection.cs
- BamlLocalizabilityResolver.cs
- ToolBarButton.cs
- StreamAsIStream.cs
- dbdatarecord.cs
- webclient.cs
- _NestedSingleAsyncResult.cs
- DesignerAdapterUtil.cs
- DataSourceXmlClassAttribute.cs
- EnumMember.cs
- SecurityStandardsManager.cs
- QilStrConcatenator.cs
- BaseConfigurationRecord.cs
- HttpProtocolReflector.cs
- PersonalizationStateQuery.cs
- WebBrowser.cs
- OutputCacheSettingsSection.cs
- SafeFileMappingHandle.cs
- StyleTypedPropertyAttribute.cs
- OperationResponse.cs
- PathFigureCollection.cs
- Timeline.cs
- RewritingPass.cs
- DataList.cs
- XamlToRtfParser.cs
- VersionedStreamOwner.cs
- DataGridPagerStyle.cs
- WSFederationHttpSecurityElement.cs
- DataViewSettingCollection.cs
- UriScheme.cs
- WindowPatternIdentifiers.cs
- AdapterUtil.cs
- UInt64.cs
- ContextProperty.cs
- HttpResponseWrapper.cs
- BufferAllocator.cs
- TextUtf8RawTextWriter.cs
- ByteAnimationBase.cs
- Control.cs
- ObjectSet.cs
- NotSupportedException.cs
- InternalDispatchObject.cs
- UnsafeNativeMethods.cs
- ModelChangedEventArgsImpl.cs
- ContextMarshalException.cs
- QueryResult.cs
- PerformanceCounterPermissionAttribute.cs
- sqlinternaltransaction.cs
- TreeNodeClickEventArgs.cs
- ServerValidateEventArgs.cs
- MeshGeometry3D.cs
- PeerNameResolver.cs
- InputGestureCollection.cs
- SelectionItemPatternIdentifiers.cs
- CodeObjectCreateExpression.cs