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
- XsltInput.cs
- GridViewAutoFormat.cs
- UITypeEditor.cs
- InstancePersistenceEvent.cs
- PageThemeParser.cs
- DrawingGroupDrawingContext.cs
- ListItemParagraph.cs
- VersionValidator.cs
- initElementDictionary.cs
- WebPartConnectionsCloseVerb.cs
- Stylesheet.cs
- XPathException.cs
- Tool.cs
- EventMap.cs
- MetaModel.cs
- DataGridViewCellStyleConverter.cs
- XmlBinaryWriter.cs
- EntityDataSourceChangedEventArgs.cs
- Substitution.cs
- DaylightTime.cs
- MultipartContentParser.cs
- BaseParaClient.cs
- InsufficientMemoryException.cs
- Int32Collection.cs
- RecognizedPhrase.cs
- XmlCharCheckingWriter.cs
- X509ThumbprintKeyIdentifierClause.cs
- DeploymentSection.cs
- ImageButton.cs
- HttpSysSettings.cs
- XmlTextReader.cs
- ColumnMapProcessor.cs
- ChangeConflicts.cs
- XmlReflectionImporter.cs
- recordstate.cs
- OverlappedAsyncResult.cs
- UrlAuthorizationModule.cs
- DataControlButton.cs
- FixUp.cs
- TextAdaptor.cs
- EncodingInfo.cs
- SqlFlattener.cs
- Signature.cs
- InputProviderSite.cs
- Rule.cs
- CaseInsensitiveComparer.cs
- OleDbDataAdapter.cs
- MetadataCache.cs
- ListBoxItemWrapperAutomationPeer.cs
- ListItemsCollectionEditor.cs
- PeekCompletedEventArgs.cs
- RuntimeResourceSet.cs
- ArrayHelper.cs
- AppDomainFactory.cs
- FixedBufferAttribute.cs
- UserPreferenceChangingEventArgs.cs
- Attributes.cs
- ReflectionHelper.cs
- CryptoApi.cs
- ObjectSecurityT.cs
- MouseEventArgs.cs
- AmbiguousMatchException.cs
- PageStatePersister.cs
- DescendentsWalkerBase.cs
- GenericIdentity.cs
- XmlFormatWriterGenerator.cs
- DynamicValidatorEventArgs.cs
- CompiledIdentityConstraint.cs
- BitmapMetadata.cs
- KeyConstraint.cs
- Compiler.cs
- Model3DCollection.cs
- XmlComplianceUtil.cs
- XsltQilFactory.cs
- SliderAutomationPeer.cs
- MenuItemAutomationPeer.cs
- Queue.cs
- ElementFactory.cs
- RayHitTestParameters.cs
- Effect.cs
- LockedAssemblyCache.cs
- COM2FontConverter.cs
- LinkLabel.cs
- OutputCacheSettingsSection.cs
- Image.cs
- DurableInstanceProvider.cs
- AttributedMetaModel.cs
- HwndKeyboardInputProvider.cs
- WebPartDisplayMode.cs
- SplineKeyFrames.cs
- WebPartTransformerAttribute.cs
- OpenTypeCommon.cs
- SecurityTokenAttachmentMode.cs
- OrderedDictionary.cs
- LambdaExpression.cs
- DataServiceQueryException.cs
- SystemTcpConnection.cs
- MissingMemberException.cs
- Int16Converter.cs
- designeractionlistschangedeventargs.cs