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
- ExtendedPropertyDescriptor.cs
- EventProviderWriter.cs
- GradientStopCollection.cs
- ScriptingSectionGroup.cs
- QueryConverter.cs
- WebEventTraceProvider.cs
- Util.cs
- ObjectSecurity.cs
- ResolveCriteria11.cs
- FormsIdentity.cs
- COAUTHIDENTITY.cs
- RequestNavigateEventArgs.cs
- QueryStringParameter.cs
- SafeWaitHandle.cs
- MD5.cs
- CodeConditionStatement.cs
- CodeAttributeArgument.cs
- UnauthorizedWebPart.cs
- FrugalMap.cs
- Operand.cs
- TextDocumentView.cs
- MemberDescriptor.cs
- DbParameterHelper.cs
- XmlQualifiedNameTest.cs
- HostExecutionContextManager.cs
- NumericUpDownAccelerationCollection.cs
- MsmqChannelFactoryBase.cs
- List.cs
- TextSerializer.cs
- DocumentPropertiesDialog.cs
- AtlasWeb.Designer.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- RelationshipDetailsCollection.cs
- FormViewCommandEventArgs.cs
- ProxyFragment.cs
- AssertSection.cs
- _LocalDataStoreMgr.cs
- httpapplicationstate.cs
- ToolStripItemImageRenderEventArgs.cs
- ExpandCollapseProviderWrapper.cs
- WindowHideOrCloseTracker.cs
- SafeNativeMethods.cs
- HandleRef.cs
- ElapsedEventArgs.cs
- WebPartEditorCancelVerb.cs
- ElementsClipboardData.cs
- Double.cs
- DebugControllerThread.cs
- StorageMappingFragment.cs
- UxThemeWrapper.cs
- _HelperAsyncResults.cs
- CodeExpressionCollection.cs
- Clipboard.cs
- EntityClientCacheEntry.cs
- Attachment.cs
- PrimitiveList.cs
- XmlSchemaSimpleContentRestriction.cs
- Menu.cs
- VectorAnimation.cs
- KeyedCollection.cs
- WebBrowserUriTypeConverter.cs
- StaticDataManager.cs
- DropShadowEffect.cs
- SQLGuid.cs
- ErrorWrapper.cs
- HashHelper.cs
- AliasedSlot.cs
- TemplateBindingExpression.cs
- ButtonRenderer.cs
- TextChangedEventArgs.cs
- ReadOnlyMetadataCollection.cs
- QueryTaskGroupState.cs
- NavigatorInvalidBodyAccessException.cs
- QilSortKey.cs
- ContainerAction.cs
- Image.cs
- HierarchicalDataBoundControl.cs
- HtmlInputButton.cs
- TextAction.cs
- ContextMenuService.cs
- ControlEvent.cs
- ExceptionCollection.cs
- QualifiedCellIdBoolean.cs
- WindowsComboBox.cs
- EmptyWithCancelationCheckWorkItem.cs
- PrivilegeNotHeldException.cs
- Mapping.cs
- SimpleFileLog.cs
- MouseGestureValueSerializer.cs
- TableLayoutStyleCollection.cs
- UriExt.cs
- HttpCookiesSection.cs
- WebPartVerb.cs
- ExpressionBindingsDialog.cs
- HttpPostedFile.cs
- MetadataItemSerializer.cs
- ListViewTableCell.cs
- FocusChangedEventArgs.cs
- D3DImage.cs
- WpfKnownTypeInvoker.cs