Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / 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 // [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); // 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. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ ///// // 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 // [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); // 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. // Copyright (c) Microsoft Corporation. All rights reserved.///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DeploymentSectionCache.cs
- FilteredDataSetHelper.cs
- DocumentEventArgs.cs
- PeerChannelFactory.cs
- AsynchronousChannelMergeEnumerator.cs
- SplineKeyFrames.cs
- AuthenticationModulesSection.cs
- DBParameter.cs
- ToolStripLabel.cs
- TargetInvocationException.cs
- UICuesEvent.cs
- HttpWebRequest.cs
- CacheChildrenQuery.cs
- PeerApplicationLaunchInfo.cs
- SortKey.cs
- ServicePointManager.cs
- AliasExpr.cs
- ValueUtilsSmi.cs
- DrawingContext.cs
- Invariant.cs
- DefaultHttpHandler.cs
- WebConfigurationHost.cs
- XsltException.cs
- PageThemeCodeDomTreeGenerator.cs
- Effect.cs
- SecurityDocument.cs
- input.cs
- _RegBlobWebProxyDataBuilder.cs
- SettingsPropertyValueCollection.cs
- OciHandle.cs
- UInt16Converter.cs
- ResourceProviderFactory.cs
- BitmapEffectGroup.cs
- ScrollPattern.cs
- FigureParaClient.cs
- WorkflowMarkupSerializationManager.cs
- PersonalizableAttribute.cs
- HttpStreamXmlDictionaryWriter.cs
- SoapAttributeAttribute.cs
- AssemblyAssociatedContentFileAttribute.cs
- DataControlFieldCell.cs
- SHA384.cs
- SqlRemoveConstantOrderBy.cs
- DataTrigger.cs
- HttpInputStream.cs
- ClientSponsor.cs
- ForwardPositionQuery.cs
- BuildResult.cs
- CqlLexerHelpers.cs
- InternalCache.cs
- BitmapEffectInputData.cs
- MsmqBindingElementBase.cs
- RandomNumberGenerator.cs
- ImageMetadata.cs
- ArraySortHelper.cs
- CalendarDay.cs
- ChannelManager.cs
- WebPermission.cs
- RowToFieldTransformer.cs
- ComPlusTypeValidator.cs
- x509utils.cs
- AnnotationResourceCollection.cs
- TraceHandlerErrorFormatter.cs
- SqlOuterApplyReducer.cs
- RootProfilePropertySettingsCollection.cs
- EntityDataSourceEntitySetNameItem.cs
- SeverityFilter.cs
- XmlQueryRuntime.cs
- BoundColumn.cs
- CapabilitiesRule.cs
- ToolBar.cs
- MenuItem.cs
- RangeValuePattern.cs
- BitmapEffectInput.cs
- sortedlist.cs
- _ConnectStream.cs
- QueryComponents.cs
- InputLangChangeEvent.cs
- StylusCollection.cs
- ConsoleKeyInfo.cs
- CodeActivityMetadata.cs
- Compiler.cs
- VisualBasicReference.cs
- SqlUtils.cs
- Rect3D.cs
- HostUtils.cs
- BulletChrome.cs
- PersonalizableTypeEntry.cs
- SessionStateSection.cs
- SimpleExpression.cs
- Attributes.cs
- GridViewSortEventArgs.cs
- FileDialogCustomPlace.cs
- MimeFormImporter.cs
- XXXInfos.cs
- DocumentViewerBase.cs
- WebReferencesBuildProvider.cs
- FreezableCollection.cs
- AsymmetricKeyExchangeDeformatter.cs
- ComplusTypeValidator.cs