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
- DurableServiceAttribute.cs
- SQLRoleProvider.cs
- SignatureHelper.cs
- HtmlElementEventArgs.cs
- ToolStripSeparatorRenderEventArgs.cs
- GenericFlowSwitchHelper.cs
- ContextMenuStrip.cs
- ToolBarOverflowPanel.cs
- InfoCardCryptoHelper.cs
- RowCache.cs
- UniqueIdentifierService.cs
- SessionPageStateSection.cs
- ProtectedConfigurationSection.cs
- AlternateView.cs
- TextDecoration.cs
- AsmxEndpointPickerExtension.cs
- PermissionListSet.cs
- ListDataHelper.cs
- WebPageTraceListener.cs
- PointAnimationBase.cs
- Wizard.cs
- RichTextBoxAutomationPeer.cs
- OrderToken.cs
- SqlInternalConnectionSmi.cs
- ProjectionQueryOptionExpression.cs
- FormsAuthenticationUser.cs
- OdbcConnectionPoolProviderInfo.cs
- ISSmlParser.cs
- SectionInformation.cs
- ProcessHostServerConfig.cs
- CommonDialog.cs
- XamlReaderConstants.cs
- AudioDeviceOut.cs
- Condition.cs
- UnicodeEncoding.cs
- TimeManager.cs
- WebErrorHandler.cs
- HtmlElement.cs
- StringDictionary.cs
- QueryInterceptorAttribute.cs
- RichTextBox.cs
- ComContractElementCollection.cs
- ShapingEngine.cs
- SequentialWorkflowRootDesigner.cs
- TimeSpanFormat.cs
- ServiceHttpHandlerFactory.cs
- EnumMember.cs
- TextSelection.cs
- DbCommandDefinition.cs
- AttributeConverter.cs
- ConditionalExpression.cs
- TargetConverter.cs
- DurableRuntimeValidator.cs
- DateTimeValueSerializerContext.cs
- Panel.cs
- ControlParameter.cs
- ColumnClickEvent.cs
- ExpressionBindingCollection.cs
- NonDualMessageSecurityOverHttp.cs
- HTTPNotFoundHandler.cs
- CreateInstanceBinder.cs
- WorkItem.cs
- HelloMessageApril2005.cs
- WorkflowMessageEventHandler.cs
- LocatorBase.cs
- KeyManager.cs
- AttributeUsageAttribute.cs
- KeyToListMap.cs
- DataGridViewComboBoxCell.cs
- ComplexLine.cs
- FieldTemplateUserControl.cs
- DataGridViewControlCollection.cs
- DateTimeOffsetStorage.cs
- DrawingCollection.cs
- DependencyProperty.cs
- XmlCountingReader.cs
- SystemTcpConnection.cs
- ValueOfAction.cs
- RegistryConfigurationProvider.cs
- WebPartZoneBase.cs
- BooleanKeyFrameCollection.cs
- DateTimeStorage.cs
- OpCellTreeNode.cs
- BaseParaClient.cs
- Keywords.cs
- ItemCheckEvent.cs
- CacheModeValueSerializer.cs
- DependencyPropertyValueSerializer.cs
- Documentation.cs
- SubstitutionList.cs
- DynamicResourceExtensionConverter.cs
- mactripleDES.cs
- Margins.cs
- DesignRelation.cs
- MessageSecurityVersion.cs
- Positioning.cs
- ToolStripArrowRenderEventArgs.cs
- smtpconnection.cs
- BStrWrapper.cs
- Paragraph.cs